Instrumenting Express.js with OpenTelemetry


  • Node.js v10+

Instrumenting Express.js app

git clone
cd example/express
  • Step 2. Install the required dependencies:
yarn install
  • Step 3. Edit main.js to configure OpenTelemetry to export data to Uptrace:
const uptrace = require('@uptrace/node')

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

    serviceName: 'myservice',
    serviceVersion: '1.0.0',
  • Step 4. Edit main.js to instrument the Express app:
const { ExpressInstrumentation } = require('@opentelemetry/instrumentation-express')
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http')


    instrumentations: [new HttpInstrumentation(), new ExpressInstrumentation()],
UPTRACE_DSN="https://<token><project_id>" node main.js

What is next?

By now, you should have a Django app with instrumented views. Next, instrumentopen in new window more operations (for example, database queries) or learn about OpenTelemetry API to create your own instrumentations.