import { StatsEngine } from '../engine/stats_engine.js'; import type DebugController from '../controller/debug_controller.js'; import type DashboardController from '../dashboard/dashboard_controller.js'; import type { DashboardStore } from '../dashboard/dashboard_store.js'; import type { DebugStore } from '../debug/debug_store.js'; import type { LogStreamService } from '../log_stream/log_stream_service.js'; import type { ApplicationService } from '@adonisjs/core/types'; export default class ServerStatsProvider { protected app: ApplicationService; private intervalId; engine: StatsEngine | null; debugStore: DebugStore | null; dashboardStore: DashboardStore | null; dashboardController: DashboardController | null; dashboardLogStream: LogStreamService | null; dashboardBroadcastTimer: ReturnType | null; debugBroadcastTimer: ReturnType | null; persistPath: string | null; flushTimer: ReturnType | null; private statsController; debugController: DebugController | null; private apiController; dashboardDepsAvailable: boolean; emailBridgeRedis: unknown; private emailBridgeChannel; private logStreamService; pinoHookActive: boolean; edgePluginActive: boolean; private prometheusActive; transmitAvailable: boolean; transmitChannels: string[]; private resolvedConfig; private resolvedCollectors; private lucidDebugConnections; /** Resolves when initStats completes (or rejects). Null if not yet scheduled. */ private initPromise; constructor(app: ApplicationService); /** * Returns a promise that resolves when the provider has finished initializing. * Route handlers can await this to avoid 503s during startup. * Resolves immediately if init already completed or was never scheduled. */ whenReady(): Promise; boot(): Promise; private initBoot; /** * Whether this package should do anything in the current environment. * * Everything is on outside production. In production nothing is registered or * built unless `production.enabled` opts in. */ private isEnabledHere; /** * Publisher-only email bridge for non-web processes (queue workers). * * The bridge publishes full mail bodies to Redis. A production worker must * stay silent unless production mode AND email capture are both opted in — * same rules the web process applies. */ private setupNonWebEmailBridge; /** Returns true only when the HTTP routes were actually registered. */ private registerRoutes; ready(): Promise; private initStats; private resolveCollectors; private setupDevToolbar; private setupLogBroadcast; private resolve; /** * Check Lucid database connections for `debug: true` and warn if missing. * Without it, Lucid won't emit `db:query` events and no queries will be captured. */ private checkLucidDebugFlag; getDiagnostics(): { timers: { collectionInterval: { active: boolean; intervalMs: number; }; dashboardBroadcast: { active: boolean; intervalMs: number; }; debugBroadcast: { active: boolean; debounceMs: number; }; persistFlush: { active: boolean; intervalMs: number; }; retentionCleanup: { active: boolean; intervalMs: number; }; }; transmit: { available: boolean; channels: string[]; }; integrations: { prometheus: { active: boolean; }; pinoHook: { active: boolean; mode: string; }; edgePlugin: { active: boolean; }; emailBridge: { active: boolean; }; cacheInspector: { available: boolean; }; queueInspector: { available: boolean; }; }; config: { intervalMs: number; transport: string; channelName: string; endpoint: string | false; skipInTest: boolean; hasOnStatsCallback: boolean; hasShouldShowCallback: boolean; }; devToolbar: { tracing: boolean; dashboard: boolean; retentionDays: number; maxDbSizeMb: number; persistDebugData: string | boolean; renderer: string; excludeFromTracing: string[]; customPaneCount: number; dashboardPath: string; debugEndpoint: string; dbPath: string; maxQueries: number; maxEvents: number; maxEmails: number; maxTraces: number; slowQueryThresholdMs: number; enabled: boolean; }; lucidDebugConnections: string[]; }; shutdown(): Promise; }