UNPKG

@dudousxd/nestjs-diagnostics

Version:

A standard convention for @dudousxd/nestjs-* libs to emit observability events over node:diagnostics_channel.

31 lines • 1.41 kB
import { type OnApplicationShutdown, type OnModuleInit } from '@nestjs/common'; import { type RecentEvent, type RecentEventsFilter } from '../recent.js'; import { type DiagnosticsModuleOptions } from './diagnostics.options.js'; /** * The buffer size `recent` asks for, or `null` when the buffer stays off: `false` → off; `true` or * `{ size }` → on; omitted → on unless `NODE_ENV` is `'production'`. */ export declare function resolveRecentSize(recent: DiagnosticsModuleOptions['recent']): number | null; /** * The recent-events buffer of this process, as a provider: starts it at module init when `recent` * says so, stops it at shutdown, and reads it. * * ```ts * constructor(private readonly recent: DiagnosticsRecentEvents) {} * this.recent.list({ lib: 'durable', limit: 50 }); * ``` */ export declare class DiagnosticsRecentEvents implements OnModuleInit, OnApplicationShutdown { private readonly size; private owned; constructor(options?: DiagnosticsModuleOptions); onModuleInit(): void; onApplicationShutdown(): void; /** Whether the buffer runs in this process. */ get enabled(): boolean; /** The newest buffered events matching `filter`, newest first. `[]` when the buffer is off. */ list(filter?: RecentEventsFilter): RecentEvent[]; /** Drop every buffered event. */ clear(): void; } //# sourceMappingURL=recent-events.service.d.ts.map