-
Notifications
You must be signed in to change notification settings - Fork 784
Fixes WebClient propagation errors and adds Brave Tests #1562
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
Conversation
In many places, the trace context of callbacks was accidentally set to the client span, not the invocation context. I noticed a hack trying to work around this. This code fixes all the problems around context. It also removes some sporadic logging, which was only applied to a few hooks. Finally, this adds Brave tests which would have caught the problems earlier. Notably, there is still more work to do as this will not help with duplicate instrumentation, which is normal when reactor-netty is the WebClient's HTTP connector.
| MonoWebClientTrace trace = new MonoWebClientTrace(next, wrapper.buildRequest(), | ||
| this, span); | ||
| // TODO: investigate why this commit leaks a scope: | ||
| // 8f5bcdabd7af23df443e771432eb85597f3b3076 |
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.
this fixed one part but not the others.. the proper fix is this PR
Codecov Report
@@ Coverage Diff @@
## 2.2.x #1562 +/- ##
===========================================
+ Coverage 60% 60.01% +0.01%
- Complexity 864 865 +1
===========================================
Files 159 159
Lines 4720 4674 -46
Branches 536 524 -12
===========================================
- Hits 2832 2805 -27
+ Misses 1637 1626 -11
+ Partials 251 243 -8
Continue to review full report at Codecov.
|
|
@simonbasle @robotmrv I noticed in #1126 we started handling both onNext and onComplete, to finish a span. The code that handles onComplete when onNext isn't called is dead code. At least in our tests it isn't invoked. I would like to remove the onComplete without onNext edge case as it isn't tested and also it is very confusing. Is there any reason why we should be so defensive? |
|
build fail is likely the ever annoying hook registration leak thing, best I can guess. Not repeatable locally of course.. I'll try to use the exact commands circle uses.. |
|
I used the same test command as circleci locally and passed.. |
|
always when a flake it passes when build with no cache.. |
When you look at the That said, Sleuth works by wrapping Another way of triggering this code path is by having an empty source: Flux.empty()
.map(i -> i)
.filter(i -> true)
.flatMap(i -> Mono.error(new RuntimeException("won't be thrown because no onNext"));Hope this helps improving the tests/understanding when It is probably true that the vast majority of |
|
@marcingrzejszczak PS since these tests are junit 4 we may need the junit-vintage-engine when you update to 5? |
|
Thanks @simonbasle moved your comment here so it isn't lost #1570 |
In many places, the trace context of callbacks was accidentally set to
the client span, not the invocation context. I noticed a hack trying to
work around this. This code fixes all the problems around context. It
also removes some sporadic logging, which was only applied to a few
hooks.
Finally, this adds Brave tests which would have caught the problems
earlier. Notably, there is still more work to do as this will not help
with duplicate instrumentation, which is normal when reactor-netty is
the WebClient's HTTP connector.