-
Notifications
You must be signed in to change notification settings - Fork 783
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
Regression: sleuth.propagation-keys aren't available in filter with WebFlux #1199
Comments
I tried to play with your example and turned on TRACE logging on both Sleuth's instrumentation and Brave. I see this:
it seems that the header is set after the filter function. However, if I change it to: .filter((request, exchangeFunction) -> {
return Mono.defer(() -> {
final String userId = request.headers().getFirst(USER_ID_KEY);
log.info("User id in filter is: {}", userId);
return exchangeFunction.exchange(request);
});
}) I get the desired result:
|
So, here is the thing. This code in Spring Framework applies all filters (Including Sleuth): After #1126, we set the headers in an appropriate place, with the respect to cold publishers (to not pollute the scope where filters are applied) Here is the change: Now, the question is whether this change is breaking one, or a bugfix, in fact :) @anatoliy-balakirev would you consider using |
Okay, after more research I figured that there was another problem (fixed in #1206) @anatoliy-balakirev I tried your example with a SNAPSHOT from that branch and now the order is correct:
|
Sorry, just got here :) |
* Fix regression introduced in #1126 (brave headers propagation) Before #1126, the headers were eagerly set in `TraceExchangeFilterFunction#filter`. After it, the side effect was moved to lazy `MonoWebClientTrace#subscribe`. However, we have everything to instrument the request in `filter`, and it can be done eagerly fixes gh-1199
Bug report:
Propagation keys are not available in the filter with WebFlux.
Spring Boot version:
2.1.2.RELEASE
Spring Cloud version:
Greenwich.RELEASE
. No issue withFinchley.RELEASE
Sample project: https://github.com/anatoliy-balakirev/sleuth-test
So basically if I set propagation key:
Within my first controller:
And then try to access it within filter, which I register in the WebClient:
I'm getting
null
there. Still that key is propagated to my next controller, I can access it there and send back:Here is the log with
Greenwich.RELEASE
:And here is with
Finchley.RELEASE
(you can uncomment it in the sample project'sbuild.gradle
to test):Regression seems to be introduced here: #1126
The text was updated successfully, but these errors were encountered: