SpanProcessor is the interface Tracer SDK uses to allow synchronous hooks for when a Span is started or when a Span is ended.

interface SpanProcessor {
    forceFlush(): Promise<void>;
    onEnd(span: ReadableSpan): void;
    onStart(span: Span, parentContext: Context): void;
    shutdown(): Promise<void>;
}

Implemented by

Methods

  • Forces to export all finished spans

    Returns Promise<void>

  • Called when a ReadableSpan is ended, if the span.isRecording() returns true.

    Parameters

    Returns void

  • Called when a Span is started, if the span.isRecording() returns true.

    Parameters

    • span: Span

      the Span that just started.

    • parentContext: Context

    Returns void

  • Shuts down the processor. Called when SDK is shut down. This is an opportunity for processor to do any cleanup required.

    Returns Promise<void>