Span implements Closeable, Serializable { public TracerManagedSpanStatus getCurrentTracerManagedSpanStatus() { return Tracer.getInstance().getCurrentManagedStatusForSpan(this); } Span(String traceId, String parentSpanId, String spanId, String spanName, boolean sampleable, String userId,
                SpanPurpose spanPurpose, long spanStartTimeEpochMicros, Long spanStartTimeNanos, Long durationNanos,
                Map<String,String> tags, List<TimestampedAnnotation> annotations
    ); protected  Span(); static Builder generateRootSpanForNewTrace(String spanName, SpanPurpose spanPurpose); Span generateChildSpan(String spanName, SpanPurpose spanPurpose); static Builder newBuilder(String spanName, SpanPurpose spanPurpose); static Builder newBuilder(Span copy); String getTraceId(); String getSpanId(); String getParentSpanId(); String getSpanName(); boolean isSampleable(); String getUserId(); long getSpanStartTimeEpochMicros(); long getSpanStartTimeNanos(); SpanPurpose getSpanPurpose(); boolean isCompleted(); Long getDurationNanos(); TracerManagedSpanStatus getCurrentTracerManagedSpanStatus(); Map<String,String> getTags(); void putTag(String key, String value); void removeTag(String key); List<TimestampedAnnotation> getTimestampedAnnotations(); void addTimestampedAnnotationForCurrentTime(String value); void addTimestampedAnnotation(TimestampedAnnotation timestampedAnnotation); @Override String toString(); String toKeyValueString(); String toJSON(); @Override void close(); @Override boolean equals(Object o); @Override int hashCode(); @Deprecated static Span fromKeyValueString(String keyValueStr); @Deprecated static Span fromJSON(String json); @Deprecated
    static final String TRACE_ID_FIELD; @Deprecated
    static final String PARENT_SPAN_ID_FIELD; @Deprecated
    static final String SPAN_ID_FIELD; @Deprecated
    static final String SPAN_NAME_FIELD; @Deprecated
    static final String SAMPLEABLE_FIELD; @Deprecated
    static final String USER_ID_FIELD; @Deprecated
    static final String SPAN_PURPOSE_FIELD; @Deprecated
    static final String START_TIME_EPOCH_MICROS_FIELD; @Deprecated
    static final String DURATION_NANOS_FIELD; }
@Test public void getCurrentTracerManagedSpanStatus_works_as_expected_for_managed_current() { { Span currentRootSpan = Tracer.getInstance().startRequestWithRootSpan("root"); TracerManagedSpanStatus tmss = currentRootSpan.getCurrentTracerManagedSpanStatus(); assertThat(tmss).isEqualTo(TracerManagedSpanStatus.MANAGED_CURRENT_ROOT_SPAN); } { Span currentSubspan = Tracer.getInstance().startSubSpan("subspan", SpanPurpose.LOCAL_ONLY); TracerManagedSpanStatus tmss = currentSubspan.getCurrentTracerManagedSpanStatus(); assertThat(tmss).isEqualTo(TracerManagedSpanStatus.MANAGED_CURRENT_SUB_SPAN); } }
@Test public void getCurrentTracerManagedSpanStatus_works_as_expected_for_managed_noncurrent() { Span nonCurrentRootSpan = Tracer.getInstance().startRequestWithRootSpan("root"); Span nonCurrentSubspan = Tracer.getInstance().startSubSpan("subspan1", SpanPurpose.LOCAL_ONLY); Span currentSubspan = Tracer.getInstance().startSubSpan("subspan2", SpanPurpose.LOCAL_ONLY); assertThat(nonCurrentRootSpan.getCurrentTracerManagedSpanStatus()) .isEqualTo(TracerManagedSpanStatus.MANAGED_NON_CURRENT_ROOT_SPAN); assertThat(nonCurrentSubspan.getCurrentTracerManagedSpanStatus()) .isEqualTo(TracerManagedSpanStatus.MANAGED_NON_CURRENT_SUB_SPAN); }