import { type OnApplicationShutdown, type OnModuleInit } from '@nestjs/common';
import { type TelescopeModuleOptions } from './telescope.options.js';
import { TelescopeService } from './telescope.service.js';
/**
 * Overhead guard / overload protection. Samples the process event-loop delay
 * histogram (`perf_hooks.monitorEventLoopDelay`) on an interval and PAUSES the
 * Recorder when the p99 lag exceeds the configured threshold, resuming once it
 * recovers — so a telescope under load can never amplify an incident.
 *
 * A startup grace (default ~5s) discards the first measurement windows so the
 * synchronous bootstrap stall (DI wiring, migrations, codegen blocking the loop)
 * never trips the guard on a transient — protection arms once the loop settles.
 *
 * Degrades to a no-op when `perf_hooks.monitorEventLoopDelay` is unavailable or
 * when `overloadProtection: false`. The sampling interval is unref'd so it never
 * keeps the host's event loop alive.
 */
export declare class TelescopeOverloadGuard implements OnModuleInit, OnApplicationShutdown {
    private readonly options;
    private readonly service;
    private readonly logger;
    private readonly maxLagMs;
    /**
     * Number of leading sample windows still to discard for the startup grace.
     * Derived from `startupGraceMs` over the sample interval; counts down on every
     * sample taken while still warming up, after which the guard judges normally.
     */
    private warmupSamplesRemaining;
    private monitor;
    private timer;
    constructor(options: TelescopeModuleOptions, service: TelescopeService);
    onModuleInit(): void;
    onApplicationShutdown(): void;
    /** Read the rolling p99 lag and pause/resume the Recorder around the threshold. */
    private sample;
}
//# sourceMappingURL=telescope-overload-guard.service.d.ts.map