import { AsyncLocalStorage } from 'async_hooks'; import { RequestContext, DbCalls, DbQuery, OutboundCall } from '../types'; export declare const storage: AsyncLocalStorage; /** Creates an empty {@link DbCalls} accumulator for a new request context. */ export declare function createDbCalls(): DbCalls; /** Returns the active {@link RequestContext} for the current async call stack, or `undefined` if called outside a request. */ export declare function getContext(): RequestContext | undefined; /** * Records a completed DB query on an explicitly-provided context. * * Auto-instrumentation for pooled/multiplexed drivers (e.g. mysql2) must * capture the context synchronously at call time (via {@link getContext}) * and pass it here when the query actually completes — the driver's internal * socket I/O callback often runs outside the AsyncLocalStorage scope that was * active when the query was dispatched (the pool's socket listeners were * bound once at pool-creation time, not per-request), so calling * `storage.getStore()` again from inside that callback would return * `undefined` and silently drop the query. */ export declare function recordDbQueryOnContext(ctx: RequestContext | undefined, query: DbQuery): void; /** Records a completed DB query on the current request context. Used by manual instrumentation via `recordDbQuery`. */ export declare function recordDbQuery(query: DbQuery): void; /** Manually increments the DB call counter for the current request. Use when auto-instrumentation cannot patch the library. */ export declare function trackDbCall(count?: number): void; /** Attaches a custom key/value field to the current request's log entry. Sensitive keys are automatically redacted before shipping. */ export declare function addField(key: string, value: unknown): void; /** Records a completed outbound HTTP call on the current request context. */ export declare function recordOutboundCall(call: OutboundCall): void; //# sourceMappingURL=storage.d.ts.map