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;
    onEnding(span: Span): void;
    onStart(span: Span, parentContext: Context): void;
    shutdown(): Promise<void>;
}

Implemented by

Methods

  • Forces to export all finished spans

    Returns Promise<void>

  • Experimental

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

    Parameters

    • span: Span

      the Span that is ending.

      This method is experimental and may break in minor versions of this package

    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>