Package io.opentelemetry.sdk.trace
Interface SpanProcessor
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
BatchSpanProcessor,SimpleSpanProcessor
SpanProcessor is the interface
TracerSdk uses to allow synchronous hooks for when a
Span is started or when a Span is ended.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Closes thisSpanProcessorafter processing any remaining spans, releasing any resources.static SpanProcessorcomposite(SpanProcessor... processors) Returns aSpanProcessorwhich simply delegates all processing to theprocessorsin order.static SpanProcessorcomposite(Iterable<SpanProcessor> processors) Returns aSpanProcessorwhich simply delegates all processing to theprocessorsin order.default io.opentelemetry.sdk.common.CompletableResultCodeProcesses all span events that have not yet been processed.booleanReturnstrueif thisSpanProcessorrequires end events.booleanReturnstrueif 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 Details
-
composite
Returns aSpanProcessorwhich simply delegates all processing to theprocessorsin order. -
composite
Returns aSpanProcessorwhich simply delegates all processing to theprocessorsin order. -
onStart
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
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.
-
close
default void close()Closes thisSpanProcessorafter processing any remaining spans, releasing any resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-