Package io.opentelemetry.sdk.trace
Class MultiSpanProcessor
java.lang.Object
io.opentelemetry.sdk.trace.MultiSpanProcessor
- All Implemented Interfaces:
ExtendedSpanProcessor
,SpanProcessor
,Closeable
,AutoCloseable
Implementation of the
SpanProcessor
that simply forwards all received events to a list of
SpanProcessor
s.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBoolean
private final List
<SpanProcessor> private final List
<SpanProcessor> private final List
<ExtendedSpanProcessor> private final List
<SpanProcessor> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static SpanProcessor
create
(List<SpanProcessor> spanProcessorList) Creates a newMultiSpanProcessor
.Processes all span events that have not yet been processed.boolean
Returnstrue
if thisSpanProcessor
requires end events.boolean
Returnstrue
if thisSpanProcessor
requires onEnding events.boolean
Returnstrue
if thisSpanProcessor
requires start events.void
onEnd
(ReadableSpan readableSpan) Called when aSpan
is ended, if theSpan.isRecording()
returns true.void
onEnding
(ReadWriteSpan span) Called when aSpan
is ended, but beforeSpanProcessor.onEnd(ReadableSpan)
is invoked with an immutable variant of this span.void
onStart
(Context parentContext, ReadWriteSpan readWriteSpan) Called when aSpan
is started, if theSpan.isRecording()
returns true.shutdown()
Processes all span events that have not yet been processed and closes used resources.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.opentelemetry.sdk.trace.SpanProcessor
close
-
Field Details
-
spanProcessorsStart
-
spanProcessorsEnding
-
spanProcessorsEnd
-
spanProcessorsAll
-
isShutdown
-
-
Constructor Details
-
MultiSpanProcessor
-
-
Method Details
-
create
Creates a newMultiSpanProcessor
.- Parameters:
spanProcessorList
- theList
ofSpanProcessor
s.- Returns:
- a new
MultiSpanProcessor
. - Throws:
NullPointerException
- if thespanProcessorList
isnull
.
-
onStart
Description copied from interface:SpanProcessor
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.
- Specified by:
onStart
in interfaceSpanProcessor
- Parameters:
parentContext
- the parentContext
of the span that just started.readWriteSpan
- theSpan
that just started.
-
isStartRequired
public boolean isStartRequired()Description copied from interface:SpanProcessor
Returnstrue
if thisSpanProcessor
requires start events.- Specified by:
isStartRequired
in interfaceSpanProcessor
- Returns:
true
if thisSpanProcessor
requires start events.
-
onEnd
Description copied from interface:SpanProcessor
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.
- Specified by:
onEnd
in interfaceSpanProcessor
- Parameters:
readableSpan
- theSpan
that just ended.
-
isEndRequired
public boolean isEndRequired()Description copied from interface:SpanProcessor
Returnstrue
if thisSpanProcessor
requires end events.- Specified by:
isEndRequired
in interfaceSpanProcessor
- Returns:
true
if thisSpanProcessor
requires end events.
-
onEnding
Description copied from interface:ExtendedSpanProcessor
Called when aSpan
is ended, but beforeSpanProcessor.onEnd(ReadableSpan)
is invoked with an immutable variant of this span. This means that the span will still be mutable. Note that the span will only be modifiable synchronously from this callback, concurrent modifications from other threads will be prevented. Only called ifSpan.isRecording()
returns true.This method is called synchronously on the execution thread, should not throw or block the execution thread.
- Specified by:
onEnding
in interfaceExtendedSpanProcessor
- Parameters:
span
- theSpan
that is just about to be ended.
-
isOnEndingRequired
public boolean isOnEndingRequired()Description copied from interface:ExtendedSpanProcessor
Returnstrue
if thisSpanProcessor
requires onEnding events.- Specified by:
isOnEndingRequired
in interfaceExtendedSpanProcessor
- Returns:
true
if thisSpanProcessor
requires onEnding events.
-
shutdown
Description copied from interface:SpanProcessor
Processes all span events that have not yet been processed and closes used resources.- Specified by:
shutdown
in interfaceSpanProcessor
- Returns:
- a
CompletableResultCode
which completes when shutdown is finished.
-
forceFlush
Description copied from interface:SpanProcessor
Processes all span events that have not yet been processed.- Specified by:
forceFlush
in interfaceSpanProcessor
- Returns:
- a
CompletableResultCode
which completes when currently queued spans are finished processing.
-
toString
-