HealOps LogoHealOps

@healops/opentelemetry

The official HealOps OpenTelemetry SDK for Node.js. Automatically captures and reports error spans to the HealOps platform.

Installation

npm install @healops/opentelemetry

Usage

Initialize the SDK at the very beginning of your application (e.g., in index.ts or app.ts).

import { initHealOpsOTel } from '@healops/opentelemetry';

initHealOpsOTel({
  apiKey: process.env.HEALOPS_API_KEY || 'your-api-key',
  serviceName: 'my-service',
  // Optional: Override endpoint
  // endpoint: 'https://engine.healops.ai/otel/errors'
});

Configuration

OptionTypeDescription
apiKeystringRequired. Your HealOps API key.
serviceNamestringRequired. The name of your service.
endpointstringOptional. The HealOps ingestion endpoint. Defaults to https://engine.healops.ai/otel/errors.

Features

  • Auto-instrumentation: Automatically instruments supported libraries (Express, Http, etc.) using OpenTelemetry.
  • Error Filtering: Only exports spans with status code ERROR or containing exceptions.
  • Efficient Batching: Batches spans and sends them every 5 seconds.
  • Retries: Automatically retries failed exports with exponential backoff.

Troubleshooting

If you don't see errors in HealOps:

  • Ensure HEALOPS_API_KEY is correct.
  • Verify your application has internet access to engine.healops.ai.
  • Check console for any "Failed to export spans" messages (only printed if export fails).