コンテンツにスキップ

TraceProvider

このコンテンツはまだ日本語訳がありません。

new TraceProvider(options?): TraceProvider;
Parameter Type

options

TraceProviderOptions

TraceProvider

createSpan<TSpanData>(spanOptions, parent?): Span<TSpanData>;
Type Parameter

TSpanData extends SpanData

Parameter Type

spanOptions

CreateSpanOptions<TSpanData>

parent?

| Span<any> | Trace

Span<TSpanData>


createTrace(traceOptions): Trace;
Parameter Type

traceOptions

TraceOptions

Trace


dispatchSpan<TSpanData>(span): Promise<void>;

Dispatches a completed span lifecycle to all registered processors.

This is useful when an integration receives a span that already has lifecycle timestamps and needs to fan out the lifecycle without mutating those timestamps.

Type Parameter

TSpanData extends SpanData

Parameter Type

span

Span<TSpanData>

Promise<void>


dispatchSpanEnd<TSpanData>(span): Promise<void>;

Dispatches a span end event to all registered processors.

This is useful when an integration receives a span end outside this process and needs to fan out the end without mutating the span state.

Type Parameter

TSpanData extends SpanData

Parameter Type

span

Span<TSpanData>

Promise<void>


dispatchSpanStart<TSpanData>(span): Promise<void>;

Dispatches a span start event to all registered processors.

This is useful when an integration receives a span start outside this process and needs to fan out the start without mutating the span state.

Type Parameter

TSpanData extends SpanData

Parameter Type

span

Span<TSpanData>

Promise<void>


dispatchTrace(trace): Promise<void>;

Dispatches a completed trace lifecycle to all registered processors.

This is useful when an integration receives a trace that was started and ended outside this process and needs to fan out the lifecycle without mutating the trace state.

Parameter Type

trace

Trace

Promise<void>


forceFlush(): Promise<void>;

Promise<void>


generateSpanId(): string;

Generate a new span ID.

Override this in custom providers to take precedence over configured ID generators.

string


generateTraceId(): string;

Generate a new trace ID.

Override this in custom providers to take precedence over configured ID generators.

string


getCurrentSpan():
| Span<any>
| null;

| Span<any> | null


getCurrentTrace(): Trace | null;

Get the current trace.

Trace | null

The current trace.


registerProcessor(processor): void;

Add a processor to the list of processors. Each processor will receive all traces/spans.

Parameter Type Description

processor

TracingProcessor

The processor to add.

void


setDisabled(disabled): void;
Parameter Type

disabled

boolean

void


setIdGenerator(idGenerator?): void;
Parameter Type

idGenerator?

Partial<Readonly<{ generateSpanId: () => string; generateTraceId: () => string; }>>

void


setProcessors(processors): void;

Set the list of processors. This will replace any existing processors.

Parameter Type Description

processors

TracingProcessor[]

The list of processors to set.

void


shutdown(timeout?): Promise<void>;
Parameter Type

timeout?

number

Promise<void>


startExportLoop(): void;

void