Examples

Example 1

import { HealthPlugin, createHttpIndicator } from '@setu-ts/health-plugin';

app.register(HealthPlugin({
  endpoints: {
    health: '/health',
    live: '/live',
    ready: '/ready',
  },
  indicators: [
    createHttpIndicator('external-api', { url: 'https://api.example.com/health' }),
  ],
}));

Classes

c
HealthService(
runtime: IRuntimeServices,
options?: { indicatorTimeoutMs?: number; }
)

Default implementation of IHealthService.

Functions

Interfaces

I
HealthCheckResult

The outcome of one health check.

I
HealthPluginOptions

Options for configuring the health plugin.

I
HealthReport

The aggregated health report returned by IHealthService.check().

I
HttpIndicatorOptions

Options for creating an HTTP probe indicator.

I
IHealthIndicator

A named health indicator contributing to /health, /live, and /ready.

I
IHealthService

Health service contract for registering and checking health indicators.

Type Aliases

T
HealthIndicatorEntry = IHealthIndicator | RegistryFactory<IHealthIndicator>

One entry of HealthPluginOptions.indicators: either a ready indicator instance or a factory that builds one from the service registry.

T
HealthIndicatorFn = () => Promise<HealthCheckResult>

Function form of a health indicator.

T
HealthStatus = "up" | "down" | "degraded"

Health state reported by a health indicator.

Usage

import * as Health_check_plugin___health___live___ready_endpoints_with_pluggable_indicators___This_plugin_provides_____HealthPlugin____Main_plugin_factory_that_registers__IHealthService_____HealthService____Concrete_implementation_of_the_health_service____createHttpIndicator____Factory_for_HTTP_probe_indicators___Re_exports_of__IHealthService____IHealthIndicator____HealthCheckResult____HealthIndicatorFn____HealthStatus____HealthReport__from___setu_ts_common__ from "health-plugin/src/index.ts";