use of brave.internal.recorder.PendingSpan in project brave by openzipkin.
the class Tracer method newScopedSpan.
ScopedSpan newScopedSpan(@Nullable TraceContext parent, TraceContext context, String name) {
Scope scope = currentTraceContext.newScope(context);
if (isNoop(context))
return new NoopScopedSpan(context, scope);
PendingSpan pendingSpan = pendingSpans.getOrCreate(parent, context, true);
Clock clock = pendingSpan.clock();
MutableSpan state = pendingSpan.state();
state.name(name);
return new RealScopedSpan(context, scope, state, clock, pendingSpans);
}
use of brave.internal.recorder.PendingSpan in project brave by openzipkin.
the class Tracer method _toSpan.
Span _toSpan(@Nullable TraceContext parent, TraceContext context) {
if (isNoop(context))
return new NoopSpan(context);
// allocate a mutable span in case multiple threads call this method.. they'll use the same data
PendingSpan pendingSpan = pendingSpans.getOrCreate(parent, context, false);
TraceContext pendingContext = pendingSpan.context();
// the same as pendingSpan.context()
if (pendingContext != null)
context = pendingContext;
return new RealSpan(context, pendingSpans, pendingSpan.state(), pendingSpan.clock());
}
Aggregations