Skip to content

Handle metrics for benign application failures #905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 21, 2025

Conversation

THardy98
Copy link
Contributor

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

@THardy98 THardy98 requested a review from a team as a code owner April 19, 2025 22:15
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though may want to wait for @Sushisource approval

Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

@THardy98 THardy98 force-pushed the plumb_application_failure_category branch from f133e5d to 6f4dceb Compare April 21, 2025 17:44
@THardy98 THardy98 merged commit 6f2dd37 into master Apr 21, 2025
16 checks passed
@THardy98 THardy98 deleted the plumb_application_failure_category branch April 21, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Plumb ApplicationErrorCategory to lang SDKs
3 participants