Package io.opentelemetry.sdk.trace
Class MultiSpanProcessor
- java.lang.Object
-
- io.opentelemetry.sdk.trace.MultiSpanProcessor
-
- All Implemented Interfaces:
ExtendedSpanProcessor
,SpanProcessor
,java.io.Closeable
,java.lang.AutoCloseable
final class MultiSpanProcessor extends java.lang.Object implements ExtendedSpanProcessor
Implementation of theSpanProcessor
that simply forwards all received events to a list ofSpanProcessor
s.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBoolean
isShutdown
private java.util.List<SpanProcessor>
spanProcessorsAll
private java.util.List<SpanProcessor>
spanProcessorsEnd
private java.util.List<ExtendedSpanProcessor>
spanProcessorsEnding
private java.util.List<SpanProcessor>
spanProcessorsStart
-
Constructor Summary
Constructors Modifier Constructor Description private
MultiSpanProcessor(java.util.List<SpanProcessor> spanProcessors)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static SpanProcessor
create(java.util.List<SpanProcessor> spanProcessorList)
Creates a newMultiSpanProcessor
.CompletableResultCode
forceFlush()
Processes all span events that have not yet been processed.boolean
isEndRequired()
Returnstrue
if thisSpanProcessor
requires end events.boolean
isOnEndingRequired()
Returnstrue
if thisSpanProcessor
requires onEnding events.boolean
isStartRequired()
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.CompletableResultCode
shutdown()
Processes all span events that have not yet been processed and closes used resources.java.lang.String
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 Detail
-
spanProcessorsStart
private final java.util.List<SpanProcessor> spanProcessorsStart
-
spanProcessorsEnding
private final java.util.List<ExtendedSpanProcessor> spanProcessorsEnding
-
spanProcessorsEnd
private final java.util.List<SpanProcessor> spanProcessorsEnd
-
spanProcessorsAll
private final java.util.List<SpanProcessor> spanProcessorsAll
-
isShutdown
private final java.util.concurrent.atomic.AtomicBoolean isShutdown
-
-
Constructor Detail
-
MultiSpanProcessor
private MultiSpanProcessor(java.util.List<SpanProcessor> spanProcessors)
-
-
Method Detail
-
create
static SpanProcessor create(java.util.List<SpanProcessor> spanProcessorList)
Creates a newMultiSpanProcessor
.- Parameters:
spanProcessorList
- theList
ofSpanProcessor
s.- Returns:
- a new
MultiSpanProcessor
. - Throws:
java.lang.NullPointerException
- if thespanProcessorList
isnull
.
-
onStart
public void onStart(Context parentContext, ReadWriteSpan readWriteSpan)
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
public void onEnd(ReadableSpan readableSpan)
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
public void onEnding(ReadWriteSpan span)
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
public CompletableResultCode 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
public CompletableResultCode 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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-