@dudousxd/nestjs-telescope
Version:
Laravel Telescope-style observability console for NestJS — core: watchers, recorder, correlation, SQLite store, headless API.
35 lines • 1.45 kB
TypeScript
import type { StorageProvider } from '../storage/storage-provider.js';
import { type StatsResult } from './stats.js';
export interface StatsQuery {
/** Required — stats are computed per entry type. */
type: string;
windowMs: number;
buckets?: number;
}
export interface StatsServiceOptions {
pageSize?: number;
scanCap?: number;
/** Threshold (ms) at/above which an entry counts as slow. Default 100. */
slowMs?: number;
defaultBuckets?: number;
}
/** Computes per-type analytics (latency percentiles, family/cache/status
* breakdowns, throughput) by aggregating stored entries over a window.
* Reads the store on demand and delegates the maths to {@link summarizeStats}. */
export declare class StatsService {
private readonly storage;
private readonly pageSize;
private readonly scanCap;
private readonly slowMs;
private readonly defaultBuckets;
constructor(storage: StorageProvider, options?: StatsServiceOptions);
getStats(query: StatsQuery): Promise<StatsResult>;
/**
* Queries the 1-minute latency-histogram rollups for `type` over the window,
* merges them element-wise, and estimates p50/p95/p99. Returns `undefined`
* when no histogram samples exist (total 0), so the latency block's shape and
* the "no durations ⇒ no latency" behavior match the raw path.
*/
private estimatePercentiles;
}
//# sourceMappingURL=stats.service.d.ts.map