Package io.opentelemetry.sdk.trace
Interface SpanProcessor
-
- All Known Implementing Classes:
BatchSpanProcessor,MultiSpanProcessor,SimpleSpanProcessor
public interface SpanProcessorSpanProcessor is the interfaceTracerSdkuses to allow synchronous hooks for when aSpanis started or when aSpanis ended.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default io.opentelemetry.sdk.common.CompletableResultCodeforceFlush()Processes all span events that have not yet been processed.booleanisEndRequired()Returnstrueif thisSpanProcessorrequires end events.booleanisStartRequired()Returnstrueif thisSpanProcessorrequires start events.voidonEnd(ReadableSpan span)Called when aSpanis ended, if theSpan.isRecording()returns true.voidonStart(io.opentelemetry.context.Context parentContext, ReadWriteSpan span)Called when aSpanis started, if theSpan.isRecording()returns true.default io.opentelemetry.sdk.common.CompletableResultCodeshutdown()Processes all span events that have not yet been processed and closes used resources.
-
-
-
Method Detail
-
onStart
void onStart(io.opentelemetry.context.Context parentContext, ReadWriteSpan span)Called when aSpanis 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 parentContextof the span that just started.span- theReadableSpanthat just started.
-
isStartRequired
boolean isStartRequired()
Returnstrueif thisSpanProcessorrequires start events.- Returns:
trueif thisSpanProcessorrequires start events.
-
onEnd
void onEnd(ReadableSpan span)
Called when aSpanis 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- theReadableSpanthat just ended.
-
isEndRequired
boolean isEndRequired()
Returnstrueif thisSpanProcessorrequires end events.- Returns:
trueif thisSpanProcessorrequires 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
CompletableResultCodewhich 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
CompletableResultCodewhich completes when currently queued spans are finished processing.
-
-