Node

How to monitor Node.js applications using OpenTelemetry and Prometheus?

December 5, 2025

download ready
Thank You
Your submission has been received.
We will be in touch and contact you soon!

To monitor Node.js applications using OpenTelemetry and Prometheus, you set up OpenTelemetry in your app to collect metrics and configure a Prometheus exporter to expose those metrics for scraping.

OpenTelemetry auto-instruments common Node.js modules and exposes metrics via a Prometheus exporter endpoint. Prometheus then regularly scrapes this endpoint to gather your app’s telemetry data, helping track performance and resource use effectively.

Code

const { NodeSDK } = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');

const prometheusExporter = new PrometheusExporter({ port: 9091, endpoint: '/metrics' }, () => {
  console.log('Prometheus scrape endpoint: http://localhost:9091/metrics');
});

const sdk = new NodeSDK({
  metricReader: prometheusExporter,
  instrumentations: [getNodeAutoInstrumentations()],
});

sdk.start();

Exposes Prometheus /metrics endpoint on port 9091.

Hire Now!

Need Help with Node Development ?

Work with our skilled node developers to accelerate your project and boost its performance.
**Hire now**Hire Now**Hire Now**Hire now**Hire now