Package io.opentelemetry.sdk.trace
Interface SpanProcessor
-
- All Known Implementing Classes:
BatchSpanProcessor
,SimpleSpanProcessor
public interface SpanProcessor
SpanProcessor is the interfaceTracerSdk
uses to allow synchronous hooks for when aSpan
is started or when aSpan
is ended.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static SpanProcessor
composite(SpanProcessor... processors)
Returns aSpanProcessor
which simply delegates all processing to theprocessors
in order.static SpanProcessor
composite(Iterable<SpanProcessor> processors)
Returns aSpanProcessor
which simply delegates all processing to theprocessors
in order.default io.opentelemetry.sdk.common.CompletableResultCode
forceFlush()
Processes all span events that have not yet been processed.boolean
isEndRequired()
Returnstrue
if thisSpanProcessor
requires end events.boolean
isStartRequired()
Returnstrue
if thisSpanProcessor
requires start events.void
onEnd(ReadableSpan span)
Called when aSpan
is ended, if theSpan.isRecording()
returns true.void
onStart(io.opentelemetry.context.Context parentContext, ReadWriteSpan span)
Called when aSpan
is started, if theSpan.isRecording()
returns true.default io.opentelemetry.sdk.common.CompletableResultCode
shutdown()
Processes all span events that have not yet been processed and closes used resources.
-
-
-
Method Detail
-
composite
static SpanProcessor composite(SpanProcessor... processors)
Returns aSpanProcessor
which simply delegates all processing to theprocessors
in order.
-
composite
static SpanProcessor composite(Iterable<SpanProcessor> processors)
Returns aSpanProcessor
which simply delegates all processing to theprocessors
in order.
-
onStart
void onStart(io.opentelemetry.context.Context parentContext, ReadWriteSpan span)
Called when aSpan
is started, if theSpan.isRecording()
returns true.This method is called synchronously on the execution thread, should not throw or block the execution thread.
- Parameters:
parentContext
- the parentContext
of the span that just started.span
- theReadableSpan
that just started.
-
isStartRequired
boolean isStartRequired()
Returnstrue
if thisSpanProcessor
requires start events.- Returns:
true
if thisSpanProcessor
requires start events.
-
onEnd
void onEnd(ReadableSpan span)
Called when aSpan
is ended, if theSpan.isRecording()
returns true.This method is called synchronously on the execution thread, should not throw or block the execution thread.
- Parameters:
span
- theReadableSpan
that just ended.
-
isEndRequired
boolean isEndRequired()
Returnstrue
if thisSpanProcessor
requires end events.- Returns:
true
if thisSpanProcessor
requires end events.
-
shutdown
default io.opentelemetry.sdk.common.CompletableResultCode shutdown()
Processes all span events that have not yet been processed and closes used resources.- Returns:
- a
CompletableResultCode
which completes when shutdown is finished.
-
forceFlush
default io.opentelemetry.sdk.common.CompletableResultCode forceFlush()
Processes all span events that have not yet been processed.- Returns:
- a
CompletableResultCode
which completes when currently queued spans are finished processing.
-
-