UNPKG

nestjs-otel

Version:
37 lines (36 loc) 1.25 kB
import type { Context } from "@opentelemetry/api"; import type { ReadableSpan, Span, SpanProcessor } from "@opentelemetry/sdk-trace-base"; /** * The local-root span for the given trace (the span with no in-process * parent — usually the HTTP server span created by instrumentation), or * undefined when the WideEventSpanProcessor is not registered or the span has * already ended. * * @internal */ export declare function getLocalRootSpan(traceId: string): Span | undefined; /** * Tracks the local-root span of every trace so the WideEventInterceptor can * flush accumulated attributes onto it instead of a nested instrumentation * span (e.g. the per-request span created by instrumentation-nestjs-core or * the per-phase spans created by @fastify/otel). * * Register it on your NodeSDK alongside the exporting processor: * * ```ts * new NodeSDK({ * spanProcessors: [ * new WideEventSpanProcessor(), * new BatchSpanProcessor(traceExporter), * ], * }); * ``` * * @publicApi */ export declare class WideEventSpanProcessor implements SpanProcessor { onStart(span: Span, _parentContext: Context): void; onEnd(span: ReadableSpan): void; forceFlush(): Promise<void>; shutdown(): Promise<void>; }