Interface Tracer

All Superinterfaces:
AutoCloseable, Closeable, TransportTracer
All Known Implementing Classes:
NoopTracer

@ExperimentalApi public interface Tracer extends TransportTracer, Closeable
Tracer is the interface used to create a Span It automatically handles the context propagation between threads, tasks, nodes etc.

All methods on the Tracer object are multi-thread safe.

Opensearch.experimental:
  • Method Details

    • startSpan

      Span startSpan(SpanCreationContext context)
      Starts the Span with given SpanCreationContext
      Parameters:
      context - span context
      Returns:
      span, must be closed.
    • getCurrentSpan

      SpanContext getCurrentSpan()
      Returns the current span.
      Returns:
      current wrapped span.
    • startScopedSpan

      ScopedSpan startScopedSpan(SpanCreationContext spanCreationContext)
      Start the span and scoped it. This must be used for scenarios where SpanScope and Span lifecycles are same and ends within the same thread where created.
      Parameters:
      spanCreationContext - span creation context
      Returns:
      scope of the span, must be closed with explicit close or with try-with-resource
    • withSpanInScope

      SpanScope withSpanInScope(Span span)
      Creates the Span Scope for a current thread. It's mandatory to scope the span just after creation so that it will automatically manage the attach /detach to the current thread.
      Parameters:
      span - span to be scoped
      Returns:
      ScopedSpan
    • isRecording

      boolean isRecording()
      Tells if the traces are being recorded or not
      Returns:
      boolean