/** * Plugin invocation statistics. * * Counts hook invocations, errors, and accumulated runtime per plugin so * users can confirm their plugin is actually running and catch regressions * (e.g. a plugin throwing on every request). * * Stats are tracked only for plugins the loader has registered — adapter * built-in transforms are internal plumbing and flow through the same * pipeline but aren't metered here. */ export interface HookStats { /** Number of successful invocations */ invocations: number; /** Number of times the hook threw */ errors: number; /** Accumulated execution time in milliseconds (successful calls only) */ totalMs: number; } export interface PluginStats { /** Per-hook counters, keyed by hook name (onRequest, onResponse, etc.) */ hooks: Record; /** Unix timestamp of the most recent invocation of any hook */ lastInvokedAt?: number; /** Most recent error, if any */ lastError?: { hook: string; message: string; at: number; }; } /** * Register a plugin name for stats tracking. Called by the loader after * a plugin validates successfully. Resets any prior stats for that name * (so /plugins/reload gives you a clean slate). */ export declare function registerPluginStats(name: string): void; /** * Drop all stats. Called before a full reload so stale data doesn't linger * for plugins that were removed from the config. */ export declare function resetAllPluginStats(): void; /** * Whether the given name is a tracked plugin. Adapter built-in transforms * aren't registered, so the runner can silently skip stats for them. */ export declare function isTrackedPlugin(name: string): boolean; /** * Record a successful invocation of a hook. */ export declare function recordInvocation(name: string, hook: string, durationMs: number): void; /** * Record an error from a hook. */ export declare function recordError(name: string, hook: string, err: unknown): void; /** * Read a snapshot of stats for one plugin. Returns a deep copy so callers * can't mutate the internal state. */ export declare function getPluginStats(name: string): PluginStats | undefined; //# sourceMappingURL=stats.d.ts.map