Skip to content

Health

Health is a small enum carried inside each service report. See Health Reporting for how to produce it; this page is the contract-side view.

Reported shape

ts
type ReportedHealth = {
  status: "HEALTHY" | "UNHEALTHY" | "UNKNOWN";
  message?: string;
  details?: Record<string, unknown>;
  observedAt: string;     // ISO timestamp
};

Effective status (server-side)

Opstage combines the reported health with agent state and report freshness to compute effectiveStatus:

InputseffectiveStatus
Agent online + recent report + HEALTHYHEALTHY
Agent online + recent report + UNHEALTHYUNHEALTHY
Agent online + recent report + UNKNOWNUNKNOWN
Agent online + report older than OPSTAGE_SERVICE_STALE_THRESHOLD_SECONDSSTALE
Agent offlineSTALE (and eventually suppressed)

Audit

Opstage writes audit events on transitions: service.health.healthy, service.health.unhealthy, service.health.stale. The audit captures the transition, not every reported sample.

Don't use health as a metric

Health is coarse. It exists to answer "is this Capsule Service okay right now?". For latency histograms, request rates, or saturation curves, use a metrics system. Opstage CE intentionally does not store time-series.

Code and docs released under Apache-2.0. "Xtrape", "Xtrape Capsule", and "Opstage" are trademarks of their respective owners.