Package io.opentelemetry.sdk.trace
Interface SpanProcessor
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
BatchSpanProcessor
,SimpleSpanProcessor
SpanProcessor is the interface
SdkTracer
uses to allow synchronous hooks for when a
Span
is started or when a Span
is ended.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Closes thisSpanProcessor
after processing any remaining spans, releasing any resources.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
Processes all span events that have not yet been processed.boolean
Returnstrue
if thisSpanProcessor
requires end events.boolean
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 Details
-
composite
Returns aSpanProcessor
which simply delegates all processing to theprocessors
in order. -
composite
Returns aSpanProcessor
which simply delegates all processing to theprocessors
in order. -
onStart
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
- theSpan
that just started.
-
isStartRequired
boolean isStartRequired()Returnstrue
if thisSpanProcessor
requires start events.- Returns:
true
if thisSpanProcessor
requires start events.
-
onEnd
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
- theSpan
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.
-
close
default void close()Closes thisSpanProcessor
after processing any remaining spans, releasing any resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-