Class SimpleSpanProcessor

  • All Implemented Interfaces:
    SpanProcessor

    public final class SimpleSpanProcessor
    extends Object
    implements SpanProcessor
    An implementation of the SpanProcessor that converts the ReadableSpan to SpanData 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, or Properties 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 Detail

      • onStart

        public void onStart​(io.opentelemetry.context.Context parentContext,
                            ReadWriteSpan span)
        Description copied from interface: SpanProcessor
        Called when a Span is started, if the Span.isRecording() returns true.

        This method is called synchronously on the execution thread, should not throw or block the execution thread.

        Specified by:
        onStart in interface SpanProcessor
        Parameters:
        parentContext - the parent Context of the span that just started.
        span - the ReadableSpan that just started.
      • onEnd

        public void onEnd​(ReadableSpan span)
        Description copied from interface: SpanProcessor
        Called when a Span is ended, if the Span.isRecording() returns true.

        This method is called synchronously on the execution thread, should not throw or block the execution thread.

        Specified by:
        onEnd in interface SpanProcessor
        Parameters:
        span - the ReadableSpan that just ended.
      • 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 interface SpanProcessor
        Returns:
        a CompletableResultCode which completes when shutdown is finished.