Monitor Express.js with OpenTelemetry

Express is a Node.js web application framework that provides various features for building web and mobile applications.

In this article you will learn how to monitor and optimize Express.js performance using OpenTelemetry observability framework.

What is OpenTelemetry?

OpenTelemetryopen in new window is an open-source observability framework for distributed tracingopen in new window (including logs and errors) and metricsopen in new window.

Otel allows developers to collect and export telemetry data in a vendor agnostic way. With OpenTelemetry, you can instrumentopen in new window your application once and then add or change vendors without changing the instrumentation, for example, here is a list popular DataDog alternativesopen in new window that support OpenTelemetry.

OpenTelemetry is available for most programming languages and provides interoperability across different languages and environments.


To instrument an Express.js app, you need to install OpenTelementry JS distro for Uptraceopen in new window which will automatically install all available instrumentations:

# Using npm
npm install @uptrace/node

# Using yarn
yarn add @uptrace/node


After installing OpenTelemetry, you need to configureopen in new window it like this:

const uptrace = require('@uptrace/node')

    // Set dsn or UPTRACE_DSN env var.
    dsn: '',

    serviceName: 'myservice',
    serviceVersion: '1.0.0',

function main() {
  // start the app here

See OpenTelemetry Express.js exampleopen in new window for details.

What is Uptrace?

Once your app is instrumented, you need a backend platform to store observability data collected by OpenTelemetry.

Uptrace is an open source APM for OpenTelemetry that helps developers pinpoint failures and find performance bottlenecks. Uptrace can process billions of spans on a single server and allows to monitor your software at 10x lower cost.

You can get startedopen in new window with Uptrace by downloading a DEB/RPM package or a pre-compiled Go binary.

What's next?

Next, instrument more operations, for example, database queries and network calls. You can also learn about OpenTelemetry JS API to create your own instrumentations.

Last Updated: