Skip to content
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

set root cause as the exception_name in micrometer tags #1883

Merged
merged 10 commits into from Dec 18, 2022
Merged

set root cause as the exception_name in micrometer tags #1883

merged 10 commits into from Dec 18, 2022

Conversation

chao-chang-paypay
Copy link
Contributor

resolves #1882

@@ -63,14 +64,14 @@ public Object decode(Response response, Type type)
} catch (IOException | RuntimeException e) {
metricRegistry.meter(
metricName.metricName(template.methodMetadata(), template.feignTarget(), "error_count")
.tagged("exception_name", e.getClass().getSimpleName())
.tagged("exception_name", ExceptionUtils.getRootCause(e).getClass().getSimpleName())
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking a bit more about this.... we are breaking the existing contract with this change.

Can we leave exception_name as was and add root_cause_name for this?

Cheers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, that makes more sense, made the same change in 23cb5ed , can you take a look at it again?

@@ -65,6 +66,8 @@ protected void recordFailure(RequestTemplate template, FeignException e) {
httpResponseCode(template),
"exception_name",
e.getClass().getSimpleName(),
"root_cause_name",
ExceptionUtils.getRootCause(e).getClass().getSimpleName(),
Copy link
Member

Choose a reason for hiding this comment

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

getCause can return null, in that case would cause NPE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ow, awesome, great!

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.

Can we set the root cause of exception in metrics?
2 participants