import { TracingProcessor } from './processor'; import { Span, SpanData, SpanOptions } from './spans'; import { Trace, TraceOptions } from './traces'; import { type TracingIdGenerator } from './utils'; export type CreateSpanOptions = Omit, 'traceId'> & { traceId?: string; disabled?: boolean; }; export type TraceProviderOptions = { idGenerator?: Partial; }; export declare class TraceProvider { #private; constructor(options?: TraceProviderOptions); /** * Add a processor to the list of processors. Each processor will receive all traces/spans. * * @param processor - The processor to add. */ registerProcessor(processor: TracingProcessor): void; /** * Set the list of processors. This will replace any existing processors. * * @param processors - The list of processors to set. */ setProcessors(processors: TracingProcessor[]): void; /** * Get the current trace. * * @returns The current trace. */ getCurrentTrace(): Trace | null; getCurrentSpan(): Span | null; setDisabled(disabled: boolean): void; setIdGenerator(idGenerator?: Partial): void; /** * Generate a new trace ID. * * Override this in custom providers to take precedence over configured ID generators. */ generateTraceId(): string; /** * Generate a new span ID. * * Override this in custom providers to take precedence over configured ID generators. */ generateSpanId(): string; startExportLoop(): 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. */ dispatchTrace(trace: Trace): Promise; /** * 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. */ dispatchSpan(span: Span): Promise; /** * 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. */ dispatchSpanStart(span: Span): Promise; /** * 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. */ dispatchSpanEnd(span: Span): Promise; createTrace(traceOptions: TraceOptions): Trace; createSpan(spanOptions: CreateSpanOptions, parent?: Span | Trace): Span; shutdown(timeout?: number): Promise; forceFlush(): Promise; } export declare function getGlobalTraceProvider(): TraceProvider;