import type { Context, Span, Tracer } from '@opentelemetry/api'; import type { MsgHdrs } from '@nats-io/nats-core'; export declare function recordCredentialOperation(operation: 'load' | 'refresh', outcome: 'success' | 'error', durationMs: number): void; export declare function recordCredentialState(state: 'loading' | 'ready' | 'refreshing' | 'expired' | 'failed'): void; export declare function getTracer(): Tracer; /** * Record an error on a span using the OTel canonical pattern: * recordException + ERROR status + a named event with the truncated stack. */ export declare function recordError(span: Span, errorEventName: string, err: unknown): void; /** * Run `fn` inside an active span. On synchronous throw or async rejection the * error is recorded, the span status is set to ERROR, and the error is * re-thrown (callers keep their existing error-handling semantics). */ export declare function withSpan(name: string, errorEventName: string, attributes: Record, fn: (span: Span) => T | Promise, parentContext?: Context): T | Promise; /** * Inject the active OTel context into a NATS headers object, creating one if * none was supplied. Returns the headers object so the caller can pass it to * `connection.publish` / `connection.request` via the `opts.headers` field. */ export declare function injectContextIntoHeaders(existing?: MsgHdrs): MsgHdrs; /** * Extract a parent OTel context from an incoming NATS message's headers. When * no traceparent is present the returned context is whatever was already * active — callers can use it as the parent for a new span without a branch. */ export declare function extractContextFromHeaders(hdrs: MsgHdrs | undefined): Context; //# sourceMappingURL=telemetry.d.ts.map