-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Replace trac(k)ing abstract with more generic context tracking #1495
Conversation
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.
needs small doc improvements, but great to be able to remove unnecessary interface ;)
* Example implementation: | ||
* <pre>{@code | ||
* if (!shouldTrack()) return context; | ||
* Marker parent = context.getOrDefault(Marker.class, null); |
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.
snippet still references Marker
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.
That's an example, Marker
is something provided by the implementation
* {@link ContextTracker} implementors receive this callback before | ||
* the {@link reactor.core.scheduler.Scheduler}s execute scheduled {@link Runnable}s. | ||
* <p> | ||
* Consider implementing it if your tracking relies on {@link ThreadLocal}s. |
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.
maybe flesh out this sentence: the method would extract key-value pairs from Context
and put them in appropriate ThreadLocal
variables, then return a Disposable
that clears said threadlocals. Maybe ThreadLocal
is not the right example either (MDC ?).
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.
Most tracers use ThreadLocal
to store the spans (as well as MDC
's implementation), hence the mention :)
But I like the idea of guiding how to implement it, will add 👍
Codecov Report
@@ Coverage Diff @@
## tracing #1495 +/- ##
=============================================
- Coverage 83.9% 83.84% -0.07%
+ Complexity 3932 3918 -14
=============================================
Files 363 363
Lines 30198 29955 -243
Branches 5601 5527 -74
=============================================
- Hits 25339 25117 -222
+ Misses 3208 3192 -16
+ Partials 1651 1646 -5
Continue to review full report at Codecov.
|
After #1492, there is no need for a special
Marker
abstraction and the Tracing story can be simplified to "Context tracking".