Handle metrics for benign application failures#905
Merged
Conversation
cretz
approved these changes
Apr 21, 2025
Contributor
cretz
left a comment
There was a problem hiding this comment.
LGTM, though may want to wait for @Sushisource approval
Sushisource
approved these changes
Apr 21, 2025
Member
Sushisource
left a comment
There was a problem hiding this comment.
Nothing blocking but I think we can ditch the closure-passing
Comment on lines
+597
to
+608
| pub(crate) fn record_failure_metric( | ||
| failure: &Option<Failure>, | ||
| metric_fn: impl FnOnce(), | ||
| ) { | ||
| let is_benign = failure | ||
| .as_ref() | ||
| .map_or(false, |f| f.is_benign_application_failure()); | ||
| if !is_benign { | ||
| metric_fn(); | ||
| } | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
I don't think we really need this function - the closure passing is a bit performative. I think it'd be easier to call this at the callsite, or, if you want to save a few lines, you can make a trait that handles the option stuff an implement it for Option<Failure> and that way you can call should_record_metric() directly on the Option<Failure>
f133e5d to
6f4dceb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
Updated temporal api to get application error category, use the category to filter out benign application failures from failure metrics.
Why?
Part of benign exceptions work
Closes #897