-
Notifications
You must be signed in to change notification settings - Fork 65
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
Adds tracing support to async boundaries in reactor-core #113
Adds tracing support to async boundaries in reactor-core #113
Conversation
Codecov Report
@@ Coverage Diff @@
## master #113 +/- ##
============================================
+ Coverage 98.87% 98.88% +<.01%
- Complexity 1239 1252 +13
============================================
Files 68 70 +2
Lines 2935 2955 +20
Branches 407 407
============================================
+ Hits 2902 2922 +20
Misses 19 19
Partials 14 14
Continue to review full report at Codecov.
|
Hey @bijukunjummen ! Thanks for the contribution. We'll try to get to this soon. In the meantime, you'll need to sign the CLA before we can accept this PR. |
Thanks @nicmunroe , I have signed the CLA now. |
Co-authored-by: RDBreed <rafaelabreed@gmail.com>
@bijukunjummen I took a quick look, and here are a few things I noticed. These may or may not be showstoppers - hard for me to say since I don't personally do much with project reactor. But in any case:
That said I can see how this PR would be useful for some users in some scenarios, so I don't want to just say no to this PR. Thoughts? |
Thanks for your thoughtful feedback @nicmunroe. I will get back soon |
Yes, I think this is a fair assumption. I see this being useful only in Spring Boot 2 based projects and the initializer will ensure that the hook takes effect before any of the reactor library functions are used.
Ah, nice catch. I think the reason was that for
Yes, I don't entirely understand how the internal caching works but will do a little more research.
Yes, good point. I believe though that |
Got a chance to test a method with normal Webflux endpoints. You are right, reactor does not appear to use the scheduler hooks at all for Webflux endpoints. But I noticed that |
I was only using that as an example. If there's any other test now or in the future that uses project reactor without using the wingtips integration, and that test happens to run first, then it will cause failures. I think the only way to truly guarantee tests always pass is to never use a built-in reusable
No, it does use the hooks - you can set breakpoints in Spring Sleuth gets around this by adding a bunch more hooks and magic. But they also cause the tracing thread-attach/detach logic to happen a lot during a request - way more than you might expect, which has a noticeable performance impact on efficient services that are high volume and low latency. So I'm hesitant to follow their lead, both for the performance impact and the maintenance hassle (the stuff they do is complex and advanced, and I'd be afraid of doing something subtly wrong that fundamentally breaks core project reactor functionality or performance). |
As far as moving the wingtips+project reactor registration to I'm on the fence on whether it should be enabled or disabled by default. I'm leaning towards disabled due to the subtle behavior concerns we've been discussing - those issues make me think it should be opt-in for users who are aware of when it will work and when it won't. Which brings up another point - these subtleties should be called out in the readme for this module. |
Yes, I feel disabled could be the right default too. I have now added support to take in a property to enable the feature.
Yes, good call. Fixed readme also |
Getting a failing test - trying to figure out how to clear the scheduler cache, doesn't look like using a |
@bijukunjummen Looks like tests are passing, so did this get resolved? Using |
Yes, it is good for one more round of review @nicmunroe - the failure was fixed after the hooks were explicitly cleared after every test:
There is a new flag to enable the feature and the details of the flag has been documented. |
@nicmunroe, this should be good to merge now? |
@bijukunjummen yes! Sorry. I'm going to do a squash-and-merge for this PR. I have some bikeshedding to do, but I'll do that in another followup PR. Thanks you so much for contributing this, and for your patience! It's much appreciated. |
@bijukunjummen this has been released in version |
Spring's project-reactor provides a powerful set of operators that abstracts some of the async operations behind simple functions like map, flatMap. This PR adds support for propagating tracing details across thread boundaries when using reactor's operators.