Package org.opensearch.telemetry.tracing
Interface Tracer
- All Superinterfaces:
AutoCloseable,Closeable,TransportTracer
- All Known Implementing Classes:
NoopTracer
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 Summary
Modifier and TypeMethodDescriptionReturns the current span.booleanTells if the traces are being recorded or notstartScopedSpan(SpanCreationContext spanCreationContext) Start the span and scoped it.startSpan(SpanCreationContext context) Starts theSpanwith givenSpanCreationContextwithSpanInScope(Span span) Creates the Span Scope for a current thread.Methods inherited from interface org.opensearch.telemetry.tracing.transport.TransportTracer
startSpan
-
Method Details
-
startSpan
Starts theSpanwith givenSpanCreationContext- Parameters:
context- span context- Returns:
- span, must be closed.
-
getCurrentSpan
SpanContext getCurrentSpan()Returns the current span.- Returns:
- current wrapped span.
-
startScopedSpan
Start the span and scoped it. This must be used for scenarios whereSpanScopeandSpanlifecycles 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
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
-