UNPKG

@sailboat-computer/health-monitoring

Version:

Comprehensive health monitoring system for sailboat computer v3 with marine-specific health checks

126 lines 4.03 kB
/** * Core health check engine for marine systems */ import { HealthCheckResult, HealthCheckConfig, OperationalContextType, MarineSystemTypeType, MarineEnvironmentStatus, HealthMonitoringEvent } from '../types'; /** * Abstract base class for health checks */ export declare abstract class BaseHealthCheck { protected config: HealthCheckConfig; protected lastResult?: HealthCheckResult; protected consecutiveFailures: number; protected lastExecutionTime: number; constructor(config: HealthCheckConfig); /** * Execute the health check */ execute(operationalContext: OperationalContextType, marineEnvironment?: MarineEnvironmentStatus): Promise<HealthCheckResult>; /** * Get the last health check result */ getLastResult(): HealthCheckResult | undefined; /** * Get health check configuration */ getConfig(): HealthCheckConfig; /** * Check if health check should execute in current context */ protected shouldExecute(operationalContext: OperationalContextType, marineEnvironment?: MarineEnvironmentStatus): boolean; /** * Get timeout context for this health check */ protected getTimeoutContext(operationalContext: OperationalContextType): import("@sailboat-computer/resilience").TimeoutExecutionContext; /** * Create a skipped result */ protected createSkippedResult(operationalContext: OperationalContextType, reason: string): HealthCheckResult; /** * Create a failure result */ protected createFailureResult(operationalContext: OperationalContextType, error: Error, executionTime: number): HealthCheckResult; /** * Abstract method to perform the actual health check */ protected abstract performCheck(operationalContext: OperationalContextType, marineEnvironment?: MarineEnvironmentStatus): Promise<HealthCheckResult>; } /** * Health check scheduler and executor */ export declare class HealthCheckEngine { private healthChecks; private scheduledChecks; private eventListeners; private isRunning; private currentOperationalContext; private currentMarineEnvironment?; /** * Register a health check */ registerHealthCheck(healthCheck: BaseHealthCheck): void; /** * Unregister a health check */ unregisterHealthCheck(checkId: string): void; /** * Start the health check engine */ start(): void; /** * Stop the health check engine */ stop(): void; /** * Update operational context */ updateOperationalContext(context: OperationalContextType): void; /** * Update marine environment status */ updateMarineEnvironment(environment: MarineEnvironmentStatus): void; /** * Execute a specific health check immediately */ executeHealthCheck(checkId: string): Promise<HealthCheckResult | null>; /** * Get all health check results */ getAllResults(): Map<string, HealthCheckResult>; /** * Get health checks by system type */ getHealthChecksBySystem(systemType: MarineSystemTypeType): BaseHealthCheck[]; /** * Add event listener */ onEvent(listener: (event: HealthMonitoringEvent) => void): void; /** * Remove event listener */ removeEventListener(listener: (event: HealthMonitoringEvent) => void): void; /** * Schedule a health check */ private scheduleHealthCheck; /** * Get health checks affected by operational context change */ private getAffectedChecks; /** * Reschedule health checks affected by context change */ private rescheduleAffectedChecks; /** * Adjust health check scheduling for marine environment */ private adjustForEnvironment; /** * Emit health monitoring event */ private emitEvent; } /** * Default health check engine instance */ export declare const defaultHealthCheckEngine: HealthCheckEngine; //# sourceMappingURL=HealthCheckEngine.d.ts.map