You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
Today the way to start and stop scoped spans is to use a code like this:
// 4. Create a scoped span, a scoped span will automatically end when closed.// It implements AutoClosable, so it'll be closed when the try block ends.try (Scopescope = tracer.spanBuilder("main").startScopedSpan()) {
System.out.println("About to do some busy work...");
for (inti = 0; i < 10; i++) {
doWork(i);
}
}
User have to propagate the Scope object between the start and stop points.
Code that semantically feels the same way will not restore context:
tracer.spanBuilder("main").startScopedSpan();
System.out.println("About to do some busy work...");
for (inti = 0; i < 10; i++) {
doWork(i);
}
tracer.getCurrentSpan().End();
And the code above may be a reality when instrumenting libraries which only expose Start and Stop callbacks. The only viable way to propagate Scope object between those callbacks may be storing this Scope object in the context the same way as Span object already saved there. So the proposal is to simplify instrumentation of those libraries.
The text was updated successfully, but these errors were encountered:
Today the way to start and stop scoped spans is to use a code like this:
User have to propagate the
Scope
object between thestart
andstop
points.Code that semantically feels the same way will not restore context:
And the code above may be a reality when instrumenting libraries which only expose
Start
andStop
callbacks. The only viable way to propagateScope
object between those callbacks may be storing thisScope
object in the context the same way asSpan
object already saved there. So the proposal is to simplify instrumentation of those libraries.The text was updated successfully, but these errors were encountered: