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 theSpanProcessor
that converts theReadableSpan
toSpanData
and 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
SimpleSpanProcessor
can be read from system properties, environment variables, orProperties
objects.For system properties and
Properties
objects,SimpleSpanProcessor
will look for the following names:otel.ssp.export.sampled
: sets whether only sampled spans should be exported.
For environment variables,
SimpleSpanProcessor
will 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 SimpleSpanProcessorBuilder
builder(SpanExporter spanExporter)
Deprecated.static SpanProcessor
create(SpanExporter exporter)
Returns a newSimpleSpanProcessor
which exports spans to theSpanExporter
synchronously.boolean
isEndRequired()
Returnstrue
if thisSpanProcessor
requires end events.boolean
isStartRequired()
Returnstrue
if thisSpanProcessor
requires start events.void
onEnd(ReadableSpan span)
Called when aSpan
is ended, if theSpan.isRecording()
returns true.void
onStart(io.opentelemetry.context.Context parentContext, ReadWriteSpan span)
Called when aSpan
is started, if theSpan.isRecording()
returns true.io.opentelemetry.sdk.common.CompletableResultCode
shutdown()
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 newSimpleSpanProcessor
which exports spans to theSpanExporter
synchronously.
-
builder
@Deprecated public static SimpleSpanProcessorBuilder builder(SpanExporter spanExporter)
Deprecated.Returns a new Builder forSimpleSpanProcessor
.- Parameters:
spanExporter
- theSpanExporter
to where the Spans are pushed.- Returns:
- a new
SimpleSpanProcessor
. - Throws:
NullPointerException
- if thespanExporter
isnull
.
-
onStart
public void onStart(io.opentelemetry.context.Context parentContext, ReadWriteSpan span)
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.span
- theReadableSpan
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 span)
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:
span
- theReadableSpan
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.
-
shutdown
public io.opentelemetry.sdk.common.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.
-
-