Class NoopTracer

java.lang.Object
org.opensearch.telemetry.tracing.noop.NoopTracer
All Implemented Interfaces:
Closeable, AutoCloseable, Tracer, TransportTracer

@InternalApi public class NoopTracer extends Object implements Tracer
No-op implementation of Tracer
Opensearch.internal:
  • Field Details

    • INSTANCE

      public static final Tracer INSTANCE
      No-op Tracer instance
  • Method Details

    • startSpan

      public Span startSpan(SpanCreationContext context)
      Description copied from interface: Tracer
      Starts the Span with given SpanCreationContext
      Specified by:
      startSpan in interface Tracer
      Parameters:
      context - span context
      Returns:
      span, must be closed.
    • getCurrentSpan

      public SpanContext getCurrentSpan()
      Description copied from interface: Tracer
      Returns the current span.
      Specified by:
      getCurrentSpan in interface Tracer
      Returns:
      current wrapped span.
    • startScopedSpan

      public ScopedSpan startScopedSpan(SpanCreationContext spanCreationContext)
      Description copied from interface: Tracer
      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.
      Specified by:
      startScopedSpan in interface Tracer
      Parameters:
      spanCreationContext - span creation context
      Returns:
      scope of the span, must be closed with explicit close or with try-with-resource
    • withSpanInScope

      public SpanScope withSpanInScope(Span span)
      Description copied from interface: Tracer
      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.
      Specified by:
      withSpanInScope in interface Tracer
      Parameters:
      span - span to be scoped
      Returns:
      ScopedSpan
    • isRecording

      public boolean isRecording()
      Description copied from interface: Tracer
      Tells if the traces are being recorded or not
      Specified by:
      isRecording in interface Tracer
      Returns:
      boolean
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • startSpan

      public Span startSpan(SpanCreationContext spanCreationContext, Map<String, Collection<String>> header)
      Description copied from interface: TransportTracer
      Start the span with propagating the tracing info from the HttpRequest header.
      Specified by:
      startSpan in interface TransportTracer
      Parameters:
      spanCreationContext - span name.
      header - transport headers
      Returns:
      the span instance