-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
No traces info anymore in implementation classes of AbstractErrorWebExceptionHandler #35604
Comments
In the handle method of GlobalErrorWebExceptionHandler, retrieve the span and add the spanId and traceId to the error response. Span currentSpan = tracer.currentSpan();
if (currentSpan != null) {
response.getHeaders().add("spanId", currentSpan.context().spanId());
response.getHeaders().add("traceId", currentSpan.context().traceId());
} Please give these suggestions a try and let me know if it helps resolve the issue. |
@GurkiratSingh37 : No, it will not run, as |
Thanks for the sample, @jackcat13. I've reproduced the behaviour that you have described but I'm curious about earlier versions.
I can reproduce the problem with 3.0.3, but with 3.0.2 the sample does not compile as the |
@wilkinsona |
@wilkinsona
I still have the issue in my codebase but I'm not yet able to find out the root cause. Thanks a lot for your help anyways :) |
@jackcat13 Interesting. Thanks. I've asked the observability team to take a look. |
This looks fairly similar to spring-projects/spring-framework#30013. The observability instrumentation in Spring Framework 6.0 is based on a I'm not sure how |
Indeed, it looks very similar. I'll give it a try once the fix is available. Thanks a lot for all your feedbacks ! |
My 5c: @jackcat13 calling
creates a leak of |
Reproducer details and problem explanation
A reproducer is shared at the following location : https://github.com/jackcat13/missingTraceAndSpanInAbstractErrorWebExceptionHandler
It contains a SpringBoot application that can be started locally. When reaching the endpoint /api/book, it raises an exception which triggers the class GlobalErrorWebExceptionHandler which extends
AbstractErrorWebExceptionHandler
Doing it, it appears that no spanId nor traceId is printed whereas it is present in the controller itslef :
The problem appeared with SpringBoot 3.0.3 version, it was not present in previous versions. The reproducer itself is relying on version 3.1.0.
Note :
Hooks.enableAutomaticContextPropagation();
statement is already called in the constructor of the SpringBootApplication class.Thanks in advance for your time on this issue.
The text was updated successfully, but these errors were encountered: