UNPKG

@iota-big3/sdk-gateway

Version:

Universal API Gateway with protocol translation, intelligent routing, rate limiting, health checking, and caching

72 lines 2.01 kB
/** * @iota-big3/sdk-gateway * Health Checker - Service health monitoring with retry and timeout support * Phase 2g Implementation */ import { AxiosInstance } from 'axios'; import { EventEmitter } from 'events'; import { HealthCheckConfig, HealthCheckEndpoint, HealthCheckFunction, HealthCheckResult, HealthStatus, OverallHealth } from '../types/gateway-types'; /** * Health checker implementation with periodic monitoring */ export declare class HealthChecker extends EventEmitter { private config; private services; private intervalId?; private running; private httpClient; constructor(config: HealthCheckConfig, httpClient?: AxiosInstance); /** * Add a custom health check function */ addCheck(serviceId: string, checkFunction: HealthCheckFunction): void; /** * Add health check for an HTTP endpoint */ addEndpointCheck(endpoint: HealthCheckEndpoint): void; /** * Check health of a specific service */ checkHealthAsync(serviceId: string): Promise<HealthCheckResult>; /** * Execute a single health check with timeout */ private executeCheckAsync; /** * Check health of all registered services */ checkAllAsync(): Promise<Record<string, HealthCheckResult>>; /** * Get overall health status */ getOverallHealthAsync(): Promise<OverallHealth>; /** * Start periodic health checks */ startAsync(): Promise<void>; /** * Stop periodic health checks */ stop(): void; /** * Check if health checker is running */ isRunning(): boolean; /** * Remove a health check */ removeCheck(serviceId: string): void; /** * Clear all health checks */ clear(): void; /** * Get current health states */ getHealthStates(): Record<string, { status?: HealthStatus; lastCheck?: Date; consecutiveFailures: number; }>; } //# sourceMappingURL=health-checker.d.ts.map