-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
@@ -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()) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as e is not null, getRootCause won’t return null as we can see here
https://github.com/OpenFeign/feign/pull/1883/files#diff-3bfdf878b3ea38d5268a9d72389c1f54ebabf1d76ad9a308e1eed93d95ed0048R38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ow, awesome, great!
* set root cause as the exception_name in micrometer tags * set root cause as the exception_name in other metrics system * set root cause as the exception_name in other metrics system * Update ExceptionUtilsTest.java * reformat * reformat * add root_cause_name instead of changing exception_name Co-authored-by: Marvin Froeder <[email protected]>
* set root cause as the exception_name in micrometer tags * set root cause as the exception_name in other metrics system * set root cause as the exception_name in other metrics system * Update ExceptionUtilsTest.java * reformat * reformat * add root_cause_name instead of changing exception_name Co-authored-by: Marvin Froeder <[email protected]>
resolves #1882