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 theSpanProcessorthat simply forwards all received events to a list ofSpanProcessors.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBooleanisShutdownprivate java.util.List<SpanProcessor>spanProcessorsAllprivate java.util.List<SpanProcessor>spanProcessorsEndprivate java.util.List<ExtendedSpanProcessor>spanProcessorsEndingprivate java.util.List<SpanProcessor>spanProcessorsStart
-
Constructor Summary
Constructors Modifier Constructor Description privateMultiSpanProcessor(java.util.List<SpanProcessor> spanProcessors)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static SpanProcessorcreate(java.util.List<SpanProcessor> spanProcessorList)Creates a newMultiSpanProcessor.CompletableResultCodeforceFlush()Processes all span events that have not yet been processed.booleanisEndRequired()Returnstrueif thisSpanProcessorrequires end events.booleanisOnEndingRequired()Returnstrueif thisSpanProcessorrequires onEnding events.booleanisStartRequired()Returnstrueif thisSpanProcessorrequires start events.voidonEnd(ReadableSpan readableSpan)Called when aSpanis ended, if theSpan.isRecording()returns true.voidonEnding(ReadWriteSpan span)Called when aSpanis ended, but beforeSpanProcessor.onEnd(ReadableSpan)is invoked with an immutable variant of this span.voidonStart(Context parentContext, ReadWriteSpan readWriteSpan)Called when aSpanis started, if theSpan.isRecording()returns true.CompletableResultCodeshutdown()Processes all span events that have not yet been processed and closes used resources.java.lang.StringtoString()-
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- theListofSpanProcessors.- Returns:
- a new
MultiSpanProcessor. - Throws:
java.lang.NullPointerException- if thespanProcessorListisnull.
-
onStart
public void onStart(Context parentContext, ReadWriteSpan readWriteSpan)
Description copied from interface:SpanProcessorCalled 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.
- Specified by:
onStartin interfaceSpanProcessor- Parameters:
parentContext- the parentContextof the span that just started.readWriteSpan- theSpanthat just started.
-
isStartRequired
public boolean isStartRequired()
Description copied from interface:SpanProcessorReturnstrueif thisSpanProcessorrequires start events.- Specified by:
isStartRequiredin interfaceSpanProcessor- Returns:
trueif thisSpanProcessorrequires start events.
-
onEnd
public void onEnd(ReadableSpan readableSpan)
Description copied from interface:SpanProcessorCalled 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.
- Specified by:
onEndin interfaceSpanProcessor- Parameters:
readableSpan- theSpanthat just ended.
-
isEndRequired
public boolean isEndRequired()
Description copied from interface:SpanProcessorReturnstrueif thisSpanProcessorrequires end events.- Specified by:
isEndRequiredin interfaceSpanProcessor- Returns:
trueif thisSpanProcessorrequires end events.
-
onEnding
public void onEnding(ReadWriteSpan span)
Description copied from interface:ExtendedSpanProcessorCalled when aSpanis 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:
onEndingin interfaceExtendedSpanProcessor- Parameters:
span- theSpanthat is just about to be ended.
-
isOnEndingRequired
public boolean isOnEndingRequired()
Description copied from interface:ExtendedSpanProcessorReturnstrueif thisSpanProcessorrequires onEnding events.- Specified by:
isOnEndingRequiredin interfaceExtendedSpanProcessor- Returns:
trueif thisSpanProcessorrequires onEnding events.
-
shutdown
public CompletableResultCode shutdown()
Description copied from interface:SpanProcessorProcesses all span events that have not yet been processed and closes used resources.- Specified by:
shutdownin interfaceSpanProcessor- Returns:
- a
CompletableResultCodewhich completes when shutdown is finished.
-
forceFlush
public CompletableResultCode forceFlush()
Description copied from interface:SpanProcessorProcesses all span events that have not yet been processed.- Specified by:
forceFlushin interfaceSpanProcessor- Returns:
- a
CompletableResultCodewhich completes when currently queued spans are finished processing.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-