Creates a new HealthService instance.
Rate limiter whose token availability is checked as part of the degraded-state heuristic
Metrics service providing EP API call and error counters used to infer reachability
Private ReadonlymetricsMetrics service providing EP API call and error counters used to infer reachability
Private ReadonlyrateRate limiter whose token availability is checked as part of the degraded-state heuristic
Private ReadonlystartPrivatebuildBuild a descriptive cache status object. Cyclomatic complexity: 2
PrivatebuildBuild rate-limiter snapshot by delegating to RateLimiter.getStatus(). Cyclomatic complexity: 1
Produces a health status snapshot.
Checks:
The check is synchronous-safe — it never makes network calls. Reachability is inferred from cached metric counters.
Structured HealthStatus object with status,
epApiReachable, cache, rateLimiter, timestamp, and uptimeMs
If the underlying metrics or rate-limiter service throws unexpectedly (should not occur under normal operating conditions)
PrivatederiveDerive the overall health verdict from sub-system checks. Cyclomatic complexity: 3
PrivateisDetermine EP API reachability from recorded metrics. Cyclomatic complexity: 2
Returns null when no API calls have been recorded yet (unknown state),
false when all calls failed (error count >= call count > 0),
true when at least some calls succeeded.
Health Check Service
Aggregates status from the rate limiter and metrics service to produce a structured HealthStatus snapshot.
The check is intentionally synchronous-safe – it never makes network calls. Network reachability is inferred from recent metrics (EP API error rate).
Example