Skip to content

Overview & Quick Start

Prometheus & OpenMetrics Exporter

@nexload-sdk/healthcheck-prometheus

v3.0.1 Released

Prometheus and OpenMetrics text serializers for @nexload-sdk/healthcheck reports.

Examples follow workspace source. Check pending Changesets against your installed version.

SDK dependencies: @nexload-sdk/healthcheck

@nexload-sdk/healthcheck-prometheus serializes @nexload-sdk/healthcheck reports directly into Prometheus text exposition and OpenMetrics format without requiring bloated third-party metric client libraries.


import { createHealthManager, runtimeInfoCheck } from "@nexload-sdk/healthcheck";
import { toPrometheusText } from "@nexload-sdk/healthcheck-prometheus";
const health = createHealthManager({
service: { name: "api" },
checks: [runtimeInfoCheck()],
});
const report = await health.run("all", { profile: "monitoring" });
const body = toPrometheusText(report, { prefix: "shop_api" });
// Content-Type: text/plain; version=0.0.4; charset=utf-8

  • toPrometheusText(report, options?): Prometheus text format 0.0.4, with no dependency on prom-client.
  • toOpenMetricsText(report, options?): OpenMetrics 1.0.0 text, ending with # EOF.
  • Status and duration series: aggregate status, per-check status, per-check duration, run duration, and every collector metric in report.metrics.
  • Label allowlist: only bounded labels are emitted (service, scope, check, component, dependency, runtime, status, error_code, collector, version). Other labels are dropped.

Terminal window
pnpm add @nexload-sdk/healthcheck-prometheus @nexload-sdk/healthcheck

Requires Node.js >=20.9.0 or Bun >=1.0.0.


Optimization

Agent usage

Playground