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
SpanProcessors.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBooleanprivate 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 SpanProcessorcreate(List<SpanProcessor> spanProcessorList) Creates a newMultiSpanProcessor.Processes all span events that have not yet been processed.booleanReturnstrueif thisSpanProcessorrequires end events.booleanReturnstrueif thisSpanProcessorrequires onEnding events.booleanReturnstrueif 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.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, waitMethods 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- theListofSpanProcessors.- Returns:
- a new
MultiSpanProcessor. - Throws:
NullPointerException- if thespanProcessorListisnull.
-
onStart
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
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
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
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
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
-