TraceProvider
此内容尚不支持你的语言。
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TraceProvider(options?): TraceProvider;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”TraceProvider
Methods
Section titled “Methods”createSpan()
Section titled “createSpan()”createSpan<TSpanData>(spanOptions, parent?): Span<TSpanData>;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Section titled “Returns”Span<TSpanData>
createTrace()
Section titled “createTrace()”createTrace(traceOptions): Trace;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”dispatchSpan()
Section titled “dispatchSpan()”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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<void>
dispatchSpanEnd()
Section titled “dispatchSpanEnd()”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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<void>
dispatchSpanStart()
Section titled “dispatchSpanStart()”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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<void>
dispatchTrace()
Section titled “dispatchTrace()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”Promise<void>
forceFlush()
Section titled “forceFlush()”forceFlush(): Promise<void>;Returns
Section titled “Returns”Promise<void>
generateSpanId()
Section titled “generateSpanId()”generateSpanId(): string;Generate a new span ID.
Override this in custom providers to take precedence over configured ID generators.
Returns
Section titled “Returns”string
generateTraceId()
Section titled “generateTraceId()”generateTraceId(): string;Generate a new trace ID.
Override this in custom providers to take precedence over configured ID generators.
Returns
Section titled “Returns”string
getCurrentSpan()
Section titled “getCurrentSpan()”getCurrentSpan(): Span<any> | null;Returns
Section titled “Returns”Span<any> | null
getCurrentTrace()
Section titled “getCurrentTrace()”getCurrentTrace(): Trace | null;Get the current trace.
Returns
Section titled “Returns”Trace | null
The current trace.
registerProcessor()
Section titled “registerProcessor()”registerProcessor(processor): void;Add a processor to the list of processors. Each processor will receive all traces/spans.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The processor to add. |
Returns
Section titled “Returns”void
setDisabled()
Section titled “setDisabled()”setDisabled(disabled): void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”void
setIdGenerator()
Section titled “setIdGenerator()”setIdGenerator(idGenerator?): void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”void
setProcessors()
Section titled “setProcessors()”setProcessors(processors): void;Set the list of processors. This will replace any existing processors.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The list of processors to set. |
Returns
Section titled “Returns”void
shutdown()
Section titled “shutdown()”shutdown(timeout?): Promise<void>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<void>
startExportLoop()
Section titled “startExportLoop()”startExportLoop(): void;Returns
Section titled “Returns”void