@Override public void flush() { abandon(); finishedSpanHandler.handle(context, state); }
@Override public Span annotate(String value) { return annotate(clock.currentTimeMicroseconds(), value); }
@Override public void finish() { finish(clock.currentTimeMicroseconds()); }
Span _toSpan(TraceContext decorated) { if (isNoop(decorated)) return new NoopSpan(decorated); // allocate a mutable span in case multiple threads call this method.. they'll use the same data PendingSpan pendingSpan = pendingSpans.getOrCreate(decorated, false); return new RealSpan(decorated, pendingSpans, pendingSpan.state(), pendingSpan.clock(), finishedSpanHandler); }
@Override public Span start() { return start(clock.currentTimeMicroseconds()); }
Span _toSpan(TraceContext decorated) { if (isNoop(decorated)) return new NoopSpan(decorated); // allocate a mutable span in case multiple threads call this method.. they'll use the same data PendingSpan pendingSpan = pendingSpans.getOrCreate(decorated, false); return new RealSpan(decorated, pendingSpans, pendingSpan.state(), pendingSpan.clock(), finishedSpanHandler); }
@Override public Span start() { return start(clock.currentTimeMicroseconds()); }
@Override public Span annotate(long timestamp, String value) { // Modern instrumentation should not send annotations such as this, but we leniently // accept them rather than fail. This for example allows old bridges like to Brave v3 to work if ("cs".equals(value)) { synchronized (state) { state.kind(Span.Kind.CLIENT); state.startTimestamp(timestamp); } } else if ("sr".equals(value)) { synchronized (state) { state.kind(Span.Kind.SERVER); state.startTimestamp(timestamp); } } else if ("cr".equals(value)) { synchronized (state) { state.kind(Span.Kind.CLIENT); } finish(timestamp); } else if ("ss".equals(value)) { synchronized (state) { state.kind(Span.Kind.SERVER); } finish(timestamp); } else { synchronized (state) { state.annotate(timestamp, value); } } return this; }
@Override public Span annotate(String value) { return annotate(clock.currentTimeMicroseconds(), value); }
@Override public void flush() { abandon(); finishedSpanHandler.handle(context, state); }
@Override public void finish() { finish(clock.currentTimeMicroseconds()); }
@Override public Span annotate(long timestamp, String value) { // Modern instrumentation should not send annotations such as this, but we leniently // accept them rather than fail. This for example allows old bridges like to Brave v3 to work if ("cs".equals(value)) { synchronized (state) { state.kind(Span.Kind.CLIENT); state.startTimestamp(timestamp); } } else if ("sr".equals(value)) { synchronized (state) { state.kind(Span.Kind.SERVER); state.startTimestamp(timestamp); } } else if ("cr".equals(value)) { synchronized (state) { state.kind(Span.Kind.CLIENT); } finish(timestamp); } else if ("ss".equals(value)) { synchronized (state) { state.kind(Span.Kind.SERVER); } finish(timestamp); } else { synchronized (state) { state.annotate(timestamp, value); } } return this; }