UNPKG

nestjs-otel

Version:
30 lines (29 loc) 934 B
import type { Attributes, AttributeValue } from "@opentelemetry/api"; /** * Accumulates attributes for the wide event of the current request. * * All methods are no-ops when called outside a request handled by the * WideEventInterceptor. * * @publicApi */ export declare class WideEventService { /** * Set a single attribute on the current wide event. */ set(key: string, value: AttributeValue): void; /** * Set multiple attributes on the current wide event. */ setMany(attributes: Attributes): void; /** * Increment a numeric attribute on the current wide event. * Starts from 0 when the attribute is absent or not a number. */ increment(key: string, by?: number): void; /** * Start a timer for the given attribute. The returned function stops * the timer and records the elapsed time in milliseconds. */ startTimer(key: string): () => void; }