UNPKG

@dudousxd/nestjs-telescope

Version:

Laravel Telescope-style observability console for NestJS — core: watchers, recorder, correlation, SQLite store, headless API.

29 lines 1.6 kB
import type { RecordInput } from '../entry/entry.js'; import type { SamplingConfig } from './options.js'; /** * Pragmatic, cheap structural error check used by tail-sampling's `keepErrors`. * Reads only shallow, already-present fields — no deep walk — so it stays on the * hot path. An entry "looks like an error" when: * - its `tags` include `'failed'`, OR * - `content.failed === true`, OR * - `content.statusCode >= 500`, OR * - `content.level` is `'warn'`, `'error'`, or `'fatal'` (a Log entry) — so a * host can sample logs aggressively (`{ log: { rate: 0.1, keepErrors: true } }`) * yet never drop a warning or error line. */ export declare function isErrorEntry(input: RecordInput): boolean; /** * Projects a {@link SamplingConfig} down to bare per-type keep-rates for the * meta/dashboard contract, which only surfaces the headline rate. Keeps the * wire shape `Record<string, number>` stable so existing consumers (the UI's * `samplingNote`) don't need to learn about tail-sampling rule objects. */ export declare function samplingRates(sampling: SamplingConfig): Record<string, number>; /** * Tail-sampling decision for one input. Plain-number per-type config behaves * exactly as a uniform keep-rate. A {@link SamplingRule} additionally always * keeps errors (`keepErrors`) and slow entries (`durationMs >= keepSlowMs`) * before falling back to the base rate. `random` is the injected 0–1 source. */ export declare function passesSampling(sampling: SamplingConfig, input: RecordInput, random: () => number): boolean; //# sourceMappingURL=sampling.d.ts.map