-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Automatic context propagation stops working after an error occurs #30013
Comments
The fact that the In order to allow As a side note, this doesn't have anything to do with automatic context propagation from Reactor 3.5.3. If handle or tap operators were used to log, they would not see the MDC context populated either, as the Reactor Context is empty. |
As discussed with @chemicL, this is a limitation of the current design which is using a This limitation is serious enough that I'm considering this a bug and should be fixed in 6.0.x. A possible solution would be to reimplement the instrumentation as a |
Prior to this commit, the Observation instrumentation for Reactive server applications was implemented with a `WebFilter`. This allowed to record observations and set up a tracing context for the controller handlers. The limitation of this approach is that all processing happening at a lower level is not aware of any observation. Here, the `HttpWebHandlerAdapter` handles several interesting aspects: * logging of HTTP requests and responses at the TRACE level * logging of client disconnect errors * handling of unresolved errors With the current instrumentation, these logging statements will miss the tracing context information. As a result, this commit deprecates the `ServerHttpObservationFilter` in favor of a more direct instrumentation of the `HttpWebHandlerAdapter`. This enables a more precise instrumentattion and allows to set up the current observation earlier in the reactor context: log statements will now contain the relevant information. Fixes spring-projectsgh-30013
Changes are ready in https://github.com/bclozel/spring-framework/tree/gh-30013, but we've decided to reschedule this for 6.1.0 as they are quite involved for a late maintenance release in the 6.0.x line. |
Related to spring-projects/spring-framework#30013 The `WebHttpHandlerBuilder` customization with an `ObservationRegistry` doesn't add a `SERVER` trace as it was with deprecated `ServerHttpObservationFilter`
Avoiding cycle between http.server and web.server packages. See gh-30013
Hi. Any news regarding releasing this change for web flux? |
@nyckyta this has been released with 6.1.0 |
@bclozel. Aha, excuse me, I see it now. Thank you |
Expected Behavior
I believe WebFilters should have auto context propagation regardless if error occurred or not.
Actual Behavior
Automatic context propagation enabled via
Hooks.enableAutomaticContextPropagation();
stops working when error was being handled in WebFilter. Once error is caught, all further WebFilters are going to be stripped of MDC context.Reproductor
I've prepared reproducer with tests describing positive and negative(failing) flow, here -> https://github.com/surmabck/spring-boot-3xx-micrometer-issues/tree/only-reactor
FYI, ticket was originally opened against reactor-core
The text was updated successfully, but these errors were encountered: