Package io.opentelemetry.sdk.trace
Interface SpanProcessor
-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
BatchSpanProcessor,SimpleSpanProcessor
@ThreadSafe public interface SpanProcessor extends Closeable
SpanProcessor is the interfaceTracerSdkuses to allow synchronous hooks for when aSpanis started or when aSpanis ended.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default 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.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
-
composite
static SpanProcessor composite(SpanProcessor... processors)
Returns aSpanProcessorwhich simply delegates all processing to theprocessorsin order.
-
composite
static SpanProcessor composite(Iterable<SpanProcessor> processors)
Returns aSpanProcessorwhich simply delegates all processing to theprocessorsin order.
-
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.
-
close
default void close()
Closes thisSpanProcessorafter processing any remaining spans, releasing any resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-