The context to use for creating a Span

interface IOTelSpanCtx {
    api: IOTelApi;
    attributes?: IOTelAttributes;
    isRecording?: boolean;
    onEnd?: ((span: IReadableSpan) => void);
    onException?: ((span: IReadableSpan, exception: OTelException, time?: OTelTimeInput) => void);
    parentSpanContext?: IDistributedTraceContext;
    spanContext: IDistributedTraceContext;
    startTime?: OTelTimeInput;
}

Properties

The current IOTelApi instance that is being used.

attributes?: IOTelAttributes
isRecording?: boolean
onEnd?: ((span: IReadableSpan) => void)

When the span ends this callback will be called to process the specified Span and end it

Type declaration

    • (span): void
    • Parameters

      Returns void

onException?: ((span: IReadableSpan, exception: OTelException, time?: OTelTimeInput) => void)

When an exception is recorded via the span's recordException API this callback will be called to process the exception. Unlike the OpenTelemetry spec this callback also provides the span instance to allow implementations to associate the exception with the span as needed. It is also called immediately when recordException is called rather than waiting until the span ends.

Type declaration

    • (span, exception, time?): void
    • Parameters

      Returns void

parentSpanContext?: IDistributedTraceContext
startTime?: OTelTimeInput

Identifies the user provided start time of the span