/** * Returns the current span in scope or null if there isn't one. * * <p>When entering user code, prefer {@link #currentSpanCustomizer()} as it is a stable type and * will never return null. */ @Nullable public Span currentSpan() { TraceContext currentContext = currentTraceContext.get(); return currentContext != null ? toSpan(currentContext) : null; }
boolean created = false; if (span != null) { span = this.tracer.toSpan(this.parent.context());
public static brave.Span toSpan(Tracer tracer, SpanId spanId) { if (tracer == null) throw new NullPointerException("tracer == null"); return tracer.toSpan(toTraceContext(spanId)); }
public static brave.Span toSpan(Tracer tracer, Span span) { if (tracer == null) throw new NullPointerException("tracer == null"); return tracer.toSpan(toTraceContext(Brave.context(span))); }
/** * Returns the current span in scope or null if there isn't one. * * <p>When entering user code, prefer {@link #currentSpanCustomizer()} as it is a stable type and * will never return null. */ @Nullable public Span currentSpan() { TraceContext currentContext = currentTraceContext.get(); return currentContext != null ? toSpan(currentContext) : null; }
brave.Span brave4(Span span) { return tracer.toSpan(toTraceContext(InternalSpan.instance.context(span))); }
boolean created = false; if (span != null) { span = this.tracer.toSpan(this.parent.context());
/** * <em>Note:</em>If the key is {@linkplain Tags#SAMPLING_PRIORITY} and the value is zero, the * current span will be abandoned and future references to the {@link #context()} will be * unsampled. This does not affect the active span, nor does it affect any equivalent instances of * this object. This is a best efforts means to handle late sampling decisions. */ @Override public BraveSpan setTag(String key, Number value) { if (finishCalled) return this; if (trySetPeer(key, value)) return this; // handle late sampling decision if (Tags.SAMPLING_PRIORITY.getKey().equals(key) && value.intValue() == 0) { delegate.abandon(); // convert the span to no-op delegate = tracer.toSpan(delegate.context().toBuilder().sampled(false).build()); } return setTag(key, value.toString()); }
.sampled(true) .build(); Span span = tracer.toSpan(traceContext).start();
.build(); Span span=tracer.toSpan(traceContext).start();