Class SimpleSpanProcessor
- java.lang.Object
-
- io.opentelemetry.sdk.trace.export.SimpleSpanProcessor
-
- All Implemented Interfaces:
SpanProcessor,Closeable,AutoCloseable
public final class SimpleSpanProcessor extends Object implements SpanProcessor
An implementation of theSpanProcessorthat converts theReadableSpantoSpanDataand passes it directly to the configured exporter. This processor should only be used where the exporter(s) are able to handle multiple exports simultaneously, as there is no back pressure consideration here.Configuration options for
SimpleSpanProcessorcan be read from system properties, environment variables, orPropertiesobjects.For system properties and
Propertiesobjects,SimpleSpanProcessorwill look for the following names:otel.ssp.export.sampled: sets whether only sampled spans should be exported.
For environment variables,
SimpleSpanProcessorwill look for the following names:OTEL_SSP_EXPORT_SAMPLED: sets whether only sampled spans should be exported.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static SimpleSpanProcessorBuilderbuilder(SpanExporter spanExporter)Deprecated.static SpanProcessorcreate(SpanExporter exporter)Returns a newSimpleSpanProcessorwhich exports spans to theSpanExportersynchronously.booleanisEndRequired()Returnstrueif thisSpanProcessorrequires end events.booleanisStartRequired()Returnstrueif thisSpanProcessorrequires start events.voidonEnd(ReadableSpan span)Called when aSpanis ended, if theSpan.isRecording()returns true.voidonStart(io.opentelemetry.context.Context parentContext, ReadWriteSpan span)Called when aSpanis started, if theSpan.isRecording()returns true.io.opentelemetry.sdk.common.CompletableResultCodeshutdown()Processes all span events that have not yet been processed and closes used resources.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.opentelemetry.sdk.trace.SpanProcessor
close, forceFlush
-
-
-
-
Method Detail
-
create
public static SpanProcessor create(SpanExporter exporter)
Returns a newSimpleSpanProcessorwhich exports spans to theSpanExportersynchronously.
-
builder
@Deprecated public static SimpleSpanProcessorBuilder builder(SpanExporter spanExporter)
Deprecated.Returns a new Builder forSimpleSpanProcessor.- Parameters:
spanExporter- theSpanExporterto where the Spans are pushed.- Returns:
- a new
SimpleSpanProcessor. - Throws:
NullPointerException- if thespanExporterisnull.
-
onStart
public void onStart(io.opentelemetry.context.Context parentContext, ReadWriteSpan span)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.span- theReadableSpanthat 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 span)
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:
span- theReadableSpanthat just ended.
-
isEndRequired
public boolean isEndRequired()
Description copied from interface:SpanProcessorReturnstrueif thisSpanProcessorrequires end events.- Specified by:
isEndRequiredin interfaceSpanProcessor- Returns:
trueif thisSpanProcessorrequires end events.
-
shutdown
public io.opentelemetry.sdk.common.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.
-
-