require a supported library after calling tracer.init().
How the plugin system works
When your application requires a supported library, dd-trace intercepts therequire call and wraps the relevant functions with tracing logic. No code changes to your application are needed beyond the initial tracer.init() call.
packages/datadog-plugin-*/. The plugin is loaded lazily the first time the corresponding npm package is required.
Disabling specific plugins
All plugins are enabled by default. Passfalse to tracer.use() to disable a specific plugin:
plugins: false in init():
Configuring plugins with tracer.use()
Use tracer.use(pluginName, config) to enable and configure a plugin at runtime. Configuration applied here overrides the defaults.
tracer.use() method is chainable and returns the tracer instance:
Common plugin options
All plugins accept these base options:| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable or disable the plugin. |
service | string | — | Override the service name for spans created by this plugin. |
measured | boolean | — | Whether to measure the span for metrics. |
| Option | Type | Description |
|---|---|---|
blocklist | string | RegExp | Function | Array | Paths that should not be instrumented. |
allowlist | string | RegExp | Function | Array | Paths that should be instrumented (all others are skipped). |
headers | string[] | Request/response headers to capture as span tags. |
validateStatus | (code: number) => boolean | Callback to determine if a status code is an error. |
hooks.request | (span, req, res) => void | Hook called just before the request span finishes. |
middleware | boolean | Whether to create spans for individual middleware functions. |
Span hooks
Web framework plugins support span hooks that let you add custom tags to spans created by the plugin:Supported plugin categories
Web Frameworks
Express, Fastify, Koa, Hapi, Next.js, Hono, Restify, Connect, Moleculer
Databases
PostgreSQL, MySQL, MongoDB, Redis, Elasticsearch, Cassandra, and more
Messaging
Kafka, RabbitMQ, BullMQ, Google Cloud Pub/Sub, AWS SQS/SNS, Azure
AI/ML
OpenAI, Anthropic, LangChain, LangGraph, Vertex AI, Google GenAI
Testing
Jest, Mocha, Cucumber, Cypress, Playwright, Vitest, Selenium
All plugins
Complete categorized list of all 100+ supported plugins
