Skip to main content
BullMQ provides built-in support for OpenTelemetry, the industry-standard observability framework. Telemetry enables you to trace jobs through their complete lifecycle, gain insights into system performance, and debug complex distributed applications.

Overview

Telemetry helps you:
  • Track job lifecycle: Observe jobs from creation through completion
  • Trace distributed systems: Follow jobs across multiple services
  • Monitor performance: Measure processing times and identify bottlenecks
  • Debug issues: Understand what happened when things go wrong
  • Correlate events: Connect jobs with external API calls and database queries

OpenTelemetry Support

BullMQ implements the OpenTelemetry specification, which provides:
  • Traces: Follow the path of jobs through your system
  • Spans: Measure the duration of specific operations
  • Metrics: Track job counts, durations, and rates (see Metrics)
  • Context propagation: Link related operations across services
BullMQ’s telemetry interface is flexible enough to support other telemetry backends in the future.

Installation

Install the BullMQ OpenTelemetry package:

Basic Setup

Adding Telemetry to Queues

Adding Telemetry to Workers

Configuration Options

Basic Configuration

tracerName
string
default:"'bullmq'"
Name for the tracer. Use your application name for easier filtering.
meterName
string
default:"'bullmq'"
Name for the meter (used with metrics).
version
string
Version string for both tracer and meter. Useful for tracking changes over time.

Enabling Metrics

enableMetrics
boolean
default:"false"
Enable OpenTelemetry metrics collection. When enabled, BullMQ automatically records job counts, durations, and other metrics.
See the OpenTelemetry Metrics section below for details on available metrics.

Backward Compatibility

The original constructor is still supported:

Running Jaeger Locally

For local development, use Jaeger to visualize traces:
Access the Jaeger UI at: http://localhost:16686

Complete Example

OpenTelemetry Metrics

When enableMetrics: true is set, BullMQ automatically records the following metrics:

Counters

Histograms

Metric Attributes

All metrics include these attributes for filtering and grouping:

Configuring Metrics Export

Set up the meter provider before creating BullMQ instances with telemetry enabled.

Custom Metric Options

You can pre-configure metrics with custom options:
The BullMQOtelMeter caches all created counters and histograms by name. When BullMQ internally calls createCounter or createHistogram with the same name, the cached instance is returned, effectively using your custom options.

Tracing Custom Operations

Add custom spans within your job processor:

Distributed Tracing

Trace jobs across multiple services:

Benefits for Large Applications

Telemetry is especially valuable in large, distributed systems:

Track Job Sources

Monitor Job Interactions

Observability Backends

OpenTelemetry integrates with many observability platforms:
  • Jaeger (open source, local development)
  • Grafana Tempo (open source)
  • Datadog
  • New Relic
  • Honeycomb
  • Lightstep
  • AWS X-Ray
  • Google Cloud Trace
Refer to the OpenTelemetry documentation for backend-specific configuration.

Best Practices

1

Use consistent naming

Use the same tracerName across all services for easier filtering in your observability backend.
2

Include version information

Set the version parameter to track changes and correlate issues with deployments.
3

Add custom attributes

Use span.setAttribute() to add context-specific information to your traces.
4

Trace external calls

Create spans for database queries, API calls, and other I/O operations to identify bottlenecks.
5

Start with sampling in production

Use sampling to reduce overhead and costs in high-volume production environments.
6

Enable metrics for production

Use enableMetrics: true to collect quantitative data alongside traces.

Sampling Configuration

For high-volume production systems, use sampling:

Performance Considerations

  • Telemetry adds minimal overhead (typically < 1ms per job)
  • Metrics are aggregated efficiently in memory
  • Spans are batched before export
  • Sampling reduces data volume in high-traffic systems

Metrics

Built-in BullMQ metrics tracking

Queue Events

Real-time job event monitoring

Going to Production

Production deployment best practices

Workers Overview

Configure and manage workers

API Reference