nestjs-otel
nestjs-otel is an OpenTelemetry integration module for NestJS applications that streamlines observability setup by providing decorators and services for distributed tracing and metrics collection. It reduces boilerplate required to emit spans and metrics to backends like Jaeger, Prometheus, and Grafana.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | pragmaticivan/nestjs-otel |
| Owner | pragmaticivan |
| Primary language | TypeScript |
| License | Apache-2.0 — OSI-approved |
| Stars | 789 |
| Forks | 65 |
| Open issues | 8 |
| Latest release | v8.1.0 (2026-06-18) |
| Last updated | 2026-07-01 |
| Source | https://github.com/pragmaticivan/nestjs-otel |
What nestjs-otel is
A TypeScript module that wraps OpenTelemetry SDK for Node.js, offering NestJS-idiomatic decorators (@Span, @Traceable, @CurrentSpan, @Baggage), interceptors (WideEventInterceptor for canonical log lines), and a TraceService for programmatic span management. Supports composite propagators and multiple exporter backends.
Get the nestjs-otel source
Clone the repository and explore it locally.
git clone https://github.com/pragmaticivan/nestjs-otel.gitcd nestjs-otel# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- NodeSDK must be initialized before NestFactory.create() to capture early application startup traces; async startup adds complexity to bootstrap flow.
- Peer dependencies (e.g., @opentelemetry/exporter-prometheus, @opentelemetry/exporter-jaeger) must be installed separately; unclear from data which versions are tested.
- @Span and @Traceable decorators work well for service methods; @CurrentSpan only works in Controllers/Resolvers, not service-to-service calls—requires architectural awareness.
- WideEventInterceptor pattern for canonical log lines requires filtering and aggregation logic downstream; ensures all request attributes are captured for debugging.
- Propagator configuration (Jaeger, B3, W3C) must match downstream service expectations; misconfiguration breaks trace correlation across services.
When to avoid it — and what to weigh
- Simple, Single-Service Applications — If running one monolithic NestJS app with no external service calls, the overhead of OTEL setup and span emission may not justify the observability gains.
- Minimal Observability Requirements — Projects needing only basic logging (no distributed tracing or metrics) should use simpler logging libraries; OTEL adds complexity without return on investment.
- No Backend Infrastructure for Exporters — If Jaeger, Prometheus, Loki, or Tempo instances are unavailable or unaffordable, spans and metrics will be dropped or buffered in-memory, creating overhead without utility.
- Strict Latency Budgets — Span processing and batch export can introduce measurable latency in high-frequency operations; profiles should validate impact before production rollout.
License & commercial use
Licensed under Apache License 2.0 (Apache-2.0), a permissive OSI-approved license.
Apache-2.0 permits commercial use, modification, and distribution with proper attribution and disclaimer of warranty. No royalties required. Verify compliance with your organization's IP policy; if bundling into proprietary products, include license notice. No commercial support details provided in repository.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Moderate |
| DEV.co fit | Good |
| Assessment confidence | High |
Module itself does not handle authentication or encryption. Spans may contain sensitive data (user IDs, request payloads); downstream exporters must enforce network security and access controls. Jaeger and Prometheus exporters should be exposed only on internal networks, not public internet. Baggage decorator carries user/tenant context; validate propagator chain to prevent context leakage across trust boundaries.
Alternatives to consider
elastic-apm-node (Elastic APM)
Provides integrated APM backend with NestJS plugins; simpler all-in-one setup but vendor-locked to Elastic. Fewer customization hooks than OTEL.
winston + pinojs (logging only)
Simpler than full OTEL for applications needing only structured logs. Does not provide distributed tracing or metrics; insufficient for microservices observability.
DD APM (Datadog)
Proprietary SaaS APM with NestJS support. Higher cost but includes integrations, sampling rules, and ML-based alerting. Requires vendor lock-in.
Build on nestjs-otel with DEV.co software developers
nestjs-otel reduces observability boilerplate and integrates seamlessly with NestJS. Consult with our engineers to design your tracing and metrics strategy for microservices.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
nestjs-otel FAQ
Does nestjs-otel emit metrics or only traces?
Can I use this without a separate OTEL backend?
Does @Span work on async methods?
How much latency does span emission add?
Software development & web development with DEV.co
DEV.co helps companies turn open-source tools like nestjs-otel into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source observability stack.
Ready to Add Observability to Your NestJS Application?
nestjs-otel reduces observability boilerplate and integrates seamlessly with NestJS. Consult with our engineers to design your tracing and metrics strategy for microservices.