dd-trace

Datadog's official Node.js APM tracer, auto-instrumenting 100+ frameworks for tracing, profiling, security, and LLM observability.

SDK
npm
v6.14.0
834stars
Apache-2.0 OR BSD-3-Clause

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
93/100Excellent
Development Activity100
Maintenance96
Community88
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture90
Code Quality88
Innovation88
Learning Curve70

dd-trace is the official Node.js client library for Datadog Application Performance Monitoring. Installed via npm install dd-trace and initialized at the top of an entrypoint (or preloaded with -r dd-trace/init), it automatically patches over a hundred popular Node.js libraries and frameworks — Express, Fastify, Koa, Next.js, gRPC, database drivers, message queues, and more — to emit distributed traces, runtime metrics, and logs correlation data to a Datadog Agent without requiring manual span instrumentation in most cases.

Beyond core tracing, dd-trace bundles the rest of Datadog’s Node.js observability surface into one package: continuous profiling, Application Security Management (WAF-based blocking, RASP, and IAST vulnerability scanning), Dynamic Instrumentation for setting breakpoints and log probes in production without redeploying, CI Visibility with flaky-test detection and intelligent test selection, and LLM Observability for tracing calls to OpenAI, Anthropic, LangChain, and other AI SDKs. Each integration lives in its own workspace package (datadog-plugin-*), letting the tracer support a wide instrumentation matrix while keeping individual integrations isolated and independently maintained.

What You Get

  • Automatic distributed tracing across 100+ supported libraries (Express, Koa, Fastify, Next.js, gRPC, HTTP, popular database and queue clients) with zero manual span code required for standard cases
  • Continuous profiling (CPU, heap, and event-loop delay) correlated directly with traces so you can see which request paths drive resource usage
  • Application Security Management: a bundled WAF for blocking known attack patterns, RASP for runtime exploit prevention, and IAST for in-app vulnerability scanning
  • Dynamic Instrumentation for attaching log probes and inspecting variables in a running production process without a redeploy
  • CI Visibility and Test Optimization — early flake detection, intelligent test runner (skip tests unaffected by a change), and per-test flakiness tracking across mocha, jest, vitest, playwright, and cypress
  • LLM Observability spans for OpenAI, Anthropic, LangChain, LangGraph, Google GenAI, and other AI SDKs, plus OpenTelemetry and OpenFeature interoperability bridges

Common Use Cases

  • Adding distributed tracing to a Node.js microservice fleet so requests can be followed end-to-end across services and downstream calls in Datadog’s APM UI
  • Diagnosing production CPU or memory spikes by pairing continuous profiling data with the specific traced requests that triggered them
  • Blocking and monitoring application-layer attacks (SQLi, SSRF, etc.) at runtime via AppSec’s WAF and RASP without changing application code
  • Speeding up CI pipelines by using Test Optimization’s intelligent test runner and early flake detection to skip unaffected or known-flaky tests
  • Tracking cost, latency, and output quality of LLM-backed features by instrumenting calls to OpenAI/Anthropic/LangChain through LLM Observability

Under The Hood

Architecture dd-trace boots through init.js, which first runs a defensive guardrails wrapper (packages/dd-trace/src/guardrails) around the real initializer so instrumentation failures can never crash the host application, then requires packages/dd-trace/src/index.js. That entrypoint checks DD_TRACE_ENABLED/OTEL_TRACES_EXPORTER and swaps in either a no-op proxy or the real proxy.js, which wires together the DatadogTracer, a PluginManager, runtime metrics, telemetry, and service-naming logic. The bulk of instrumentation lives in a monorepo workspace split: packages/datadog-instrumentations (143 files) contains lightweight hooks that subscribe to each target library’s internals via Node’s diagnostics_channel, while a parallel packages/datadog-plugin-* package (108 of them, one per integration — Express, Redis, Kafka, OpenAI, etc.) turns those channel events into spans. Cross-cutting subsystems — AppSec (WAF/RASP/IAST), the Dynamic Instrumentation debugger, the profiler, LLM Observability, and CI Visibility’s test optimization — are separate modules under packages/dd-trace/src that attach to the same core tracer, each independently enabled by config/env vars.

Tech Stack The library is almost entirely plain JavaScript (98.9%) targeting Node.js >=22 for its current v6 release line (v5 remains in maintenance for Node 18), with a thin TypeScript typings surface (index.d.ts) checked via tsc --noEmit rather than compiled. Runtime dependencies are deliberately minimal — dc-polyfill (diagnostics_channel polyfill), import-in-the-middle (ESM instrumentation hooking), and opentracing for legacy API compatibility — since this package ships inside every instrumented consumer’s process. The devDependency set is extensive by contrast: mocha with c8/nyc for coverage, sinon and proxyquire for test doubles, nock for HTTP mocking, a large custom ESLint config plus an in-repo eslint-rules/ package for project-specific lint rules, and husky-managed git hooks. CI runs across 20+ dedicated GitHub Actions workflows (appsec.yml, profiling.yml, debugger.yml, llmobs.yml, apm-integrations.yml, and more), with docker-compose used to spin up real service dependencies for integration tests.

Code Quality The test suite is large and framework-specific: 472 spec files live under packages/dd-trace/test alone, with a separate integration-tests/ tree exercising real per-framework instrumentation end-to-end. Tests run on mocha with sinon/proxyquire/nock for isolation and c8/nyc for coverage enforcement. The team enforces conventions beyond standard linting — a dedicated eslint-rules/ package, a verify-carrier-fields script, and CODEOWNERS auditing (codeowners-audit) all run in CI. Runtime code itself is plain JavaScript rather than statically typed, with TypeScript used only to validate the public .d.ts surface, so type safety is enforced at the API boundary rather than throughout the implementation. The guardrails-wrapped init path is a notable defensive pattern: instrumentation errors are caught so they can’t take down the application that loaded the tracer.

What Makes It Unique dd-trace goes well past being a plain distributed-tracing client — it’s a converged observability agent bundled as one npm package. Continuous profiling, a production-safe Dynamic Instrumentation debugger (attach log probes and inspect state without redeploying), Application Security Management (WAF blocking, RASP, and IAST scanning in the same process as the tracer), CI Test Optimization (flaky-test quarantine and intelligent test selection), and LLM Observability for AI SDK calls are all first-class subsystems rather than separate packages. Combined with a 108-plugin integration matrix spanning everything from Express to Vitest to Anthropic’s SDK, and interoperability bridges for OpenTelemetry and OpenFeature, this breadth is unusual for a single auto-instrumenting library.

Used by 8 apps in this directory

TypeScript
69%
Other

Budibase

Low Code Platforms · No Code Platforms

28,260

Build AI agents, automations, and internal apps on a single open-source platform with full self-hosting control.

View details
91
Repo Health
81
Technical
63
Dependency
Built with
TypeScript69%
Svelte26%
Updated 2 days ago
TypeScript
97%
Other

GrowthBook

Developer Tools · Analytics · Monitoring

8,299

Open source feature flags, A/B testing, and warehouse-native experimentation that queries your existing data infrastructure—no data movement required.

View details
92
Repo Health
85
Technical
63
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
91%
Apache 2.0

Helicone

Monitoring · AI Development · Analytics

6,133

An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.

View details
69
Repo Health
81
Technical
65
Dependency
Built with
TypeScript91%
Updated 1 weeks ago
TypeScript
97%
Other

Infisical

Security · Devops

29,145

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

View details
91
Repo Health
84
Technical
65
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
98%
Other

Langfuse

AI Development · Monitoring

34,264

Open source AI engineering platform for LLM observability, prompt management, evaluation, and debugging — self-host in minutes or use Langfuse Cloud.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
TypeScript98%
Updated yesterday
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

27,743

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
88
Repo Health
73
Technical
65
Dependency
Built with
TypeScript99%
Updated today
TypeScript
97%
Other

nango

Developer Tools · Automation · Authentication

11,746

Build product integrations with AI using 800+ APIs — auth, proxy, and TypeScript functions on production-grade infrastructure.

View details
93
Repo Health
85
Technical
68
Dependency
Built with
TypeScript97%
Updated 3 days ago
TypeScript
97%
Other

Outline

Knowledge Management · Collaboration

40,474

A fast, real-time collaborative knowledge base for growing teams built on React, Node.js, and ProseMirror.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript97%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search