Class OpenSpan

java.lang.Object
com.palantir.tracing.api.OpenSpan

@Immutable public abstract class OpenSpan extends Object
A value object represented an open (i.e., non-completed) span. Once completed, the span is represented by a Span object.
  • Constructor Details

    • OpenSpan

      public OpenSpan()
  • Method Details

    • getOperation

      @Parameter public abstract String getOperation()
      Returns a description of the operation for this event.
    • getStartTimeMicroSeconds

      @Parameter public abstract long getStartTimeMicroSeconds()
      Returns the start time in microseconds since epoch start of the span represented by this state.

      Users of this class should not set this value manually in the builder, it is configured automatically when using the builder() static.

    • getStartClockNanoSeconds

      @Parameter public abstract long getStartClockNanoSeconds()
      Returns the starting clock position in nanoseconds for use in computing span duration.

      Users of this class should not set this value manually in the builder, it is configured automatically when using the builder() static.

    • getParentSpanId

      @Parameter public abstract Optional<String> getParentSpanId()
      Returns the identifier of the parent span for the current span, if one exists.
    • getOriginatingSpanId

      @Deprecated public Optional<String> getOriginatingSpanId()
      Deprecated.
      No longer used.
      Returns the identifier of the 'originating' span if one exists.
      See Also:
    • getSpanId

      @Parameter public abstract String getSpanId()
      Returns a globally unique identifier representing a single span within the call trace.
    • type

      @Parameter public abstract SpanType type()
      Indicates the SpanType of this span, e.g., a server-side vs. client-side vs local span.
    • builder

      public static OpenSpan.Builder builder()
      Indicates if this trace state was sampled public abstract boolean isSampled();

      /** Returns a builder for OpenSpan pre-initialized to use the current time.

      Users should not set the startTimeMs value manually.

    • of

      @Deprecated public static OpenSpan of(String operation, String spanId, SpanType type, Optional<String> parentSpanId, Optional<String> _originatingSpanId)
      Deprecated.
      Use the variant without an originating span id
      Use this factory method to avoid OpenSpan.Builder allocations in hot paths.
    • of

      public static OpenSpan of(String operation, String spanId, SpanType type, Optional<String> parentSpanId)
      Use this factory method to avoid OpenSpan.Builder allocations in hot paths.