-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Trace and Span IDs are no longer propagated RequestBodyAdvice beans #33091
Comments
@syedyusufh just for confirmation, your sample application is named "webflux" but is actually using Spring MVC. Did you mean to use WebFlux instead? In this case, can you try with Also, could you elaborate on why you're relying on a trace being present during an asynchronous write? This is outside the scope of the controller handler, quite similar to spawning a new thread to process the request with Spring MVC async support (in this case, the threadlocals would not be set there automatically). I understand that #32730 changes the behavior here, but I'm not sure this was ever intended/supported. |
Hi @bclozel Our applications have always been Spring Web + Spring WebFlux combined, wherein Tomcat supports the Mono via Async. This has been working fine for us since Spring Boot 2.5.x atleast and until the new v3.3.1 |
@syedyusufh ok thanks for confirming - so the "webflux" in your sample is a typo, as it was never the intent to use WebFlux. I'll see if there's a way to support async dispatches again without undoing the previous fix. |
Prior to this commit, the fix for spring-projectsgh-32730 disabled the involvment of the osbervation filter for async dispatches. Instead of relying on ASYNC dispatches to close the observation for async requests, this is now using an async listener instead: async dispatches are not guaranteed to happen once the async request is handled. This change caused another side-effect: because async dispatches are not considered anymore by this filter, the observation scope is not reinstated for async dispatches. For example, `ResponseBodyAdvice` implementations do not have the observation scope opened during their execution. This commit re-enables async dispatches for this filter, but ensures that observations are not closed during such dispatches as this will be done by the async listener. Fixes spring-projectsgh-33091
I have a commit ready for this but I'm not in favor of applying it right now for the following reasons:
I do understand that the trace id is not logged anymore for I'm closing this issue for now, but we can always reconsider if we receive more feedback and descriptions of use cases that are not possible anymore. |
@bclozel TracingContext is lost in Also, Our implementation is quite similar to what is mentioned in this official documentation page https://docs.spring.io/spring-boot/reference/web/reactive.html#web.reactive.webflux Having this been available since atleast |
Reopening to check the |
Originally raised in spring-projects/spring-boot#41220 (with a reproducer project).
It looks to me like the reason for lack of Trance and Span IDs is the fix for #32730.
If you run the sample with Spring Boot 3.3.0 with a breakpoint in
OncePerRequestFilter.doFilter()
you'll see that the call toskipDispatch()
returnfalse
. With Spring Boot 3.3.1skipDispatch()
returnstrue
because theshouldNotFilterAsyncDispatch()
method has been removed.The text was updated successfully, but these errors were encountered: