nestjs-otel
Version:
NestJS OpenTelemetry Library
30 lines (29 loc) • 1.2 kB
TypeScript
import { type CallHandler, type ExecutionContext, type NestInterceptor } from "@nestjs/common";
import { Observable } from "rxjs";
import type { OpenTelemetryModuleOptions } from "../interfaces";
/**
* Opens a wide event for each request and flushes the accumulated
* attributes onto the span that was active when the request entered the
* interceptor (usually the root HTTP span created by instrumentation).
*
* Register globally with APP_INTERCEPTOR or per controller with
* UseInterceptors.
*
* @publicApi
*/
export declare class WideEventInterceptor implements NestInterceptor {
private readonly options?;
constructor(options?: OpenTelemetryModuleOptions | undefined);
intercept(executionContext: ExecutionContext, next: CallHandler): Observable<unknown>;
private rootSpanFromRequest;
/**
* Picks the span the wide event should be written to, preferring the
* local-root span (when the WideEventSpanProcessor is registered), then the
* middleware-captured root span, then the interceptor-time active span —
* skipping any that have already ended.
*/
private targetSpan;
private pickSpan;
private seed;
private flush;
}