linkedinlogo
Node
Node

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

December 5, 2025

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.

Company Deck
PDF, 3MB

© 2026 Zignuts Technolab. All Rights Reserved.