Skip to content

Healthcheck OpenTelemetry examples

import { toOtelMetricRecords } from "@nexload-sdk/healthcheck-otel";
for (const record of toOtelMetricRecords(await health.run("all"))) {
if (typeof record.value !== "number") continue;
const gauge = meter.createGauge(record.name, { unit: record.unit });
gauge.record(record.value, record.attributes);
}

Cache instruments in production rather than creating them on every run. Executable transforms: otel.test.mjs.

The documentation example is type-checked in CI: healthcheck-otel.ts.