Registry / observability / connect-datadog

connect-datadog

JSON →
library0.0.9jsnpmunverified

The `connect-datadog` package, currently at version 0.0.9 and last updated over seven years ago, provides a basic middleware for Express.js and Connect-compatible Node.js applications to send HTTP request metrics to a local Datadog Agent via the DogStatsD protocol. This middleware captures essential request telemetry such as response times, HTTP status codes, and request paths, allowing for rudimentary monitoring within Datadog dashboards. However, this library is officially deprecated and its GitHub repository is auto-archived due to inactivity. Datadog strongly recommends migrating to its comprehensive Application Performance Monitoring (APM) solutions, which offer advanced features, continuous updates, and broader integration capabilities for modern Node.js environments. There is no active release cadence for `connect-datadog`, marking it as an unmaintained and historical tool, superseded by Datadog's more robust and actively developed APM offerings. It uses `node-dogstatsd` internally, which itself has more modern alternatives.

npm install connect-datadog
INSTALL
IMPORT
SIG · CONNECT-DATADOG
C
connect-datadog
observabilityjavascriptv0.0.9
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

connectDatadog
const connectDatadog = require('connect-datadog'); app.use(connectDatadog({}));
import connectDatadog from 'connect-datadog'; // ESM not supported
This package is CommonJS-only and does not support ES module imports. The `require` call itself returns the middleware function.
DatadogOptions
const connectDatadog = require('connect-datadog'); const ddOptions = { stat: 'web.requests', tags: ['env:production'], response_code: true }; app.use(connectDatadog(ddOptions));
import { DatadogOptions } from 'connect-datadog'; // No types, no named exports
Configuration is passed as an object to the middleware function. There are no exposed types for TypeScript users, nor are there named exports.
StatsDClientOverride
const connectDatadog = require('connect-datadog'); const StatsD = require('node-dogstatsd').StatsD; const customDogstatsdClient = new StatsD({ host: '127.0.0.1', port: 8125 }); app.use(connectDatadog({ dogstatsd: customDogstatsdClient }));
const customDogstatsdClient = new SomeOtherClient(); // Must be node-dogstatsd compatible
The `dogstatsd` option expects an instance of a `node-dogstatsd` compatible client. Using a different StatsD client might lead to unexpected behavior or errors.

Demonstrates integrating the `connect-datadog` middleware into a basic Express application to send HTTP request metrics to a Datadog Agent.

const express = require('express'); const connectDatadog = require('connect-datadog'); const app = express(); const port = process.env.PORT || 3000; // Datadog middleware options const ddOptions = { stat: 'node.express.router', tags: ['app:my-old-express-app', 'environment:development'], path: true, // Include path tag method: true, // Include http method tag response_code: true // Include http response code tag }; // Add middleware immediately before your router, as per original instructions. // NOTE: The example `app.use(app.router)` is deprecated in modern Express. // Instead, place this middleware before your route definitions. app.use(connectDatadog(ddOptions)); app.get('/', (req, res) => { res.send('Hello from Datadog-monitored Express App!'); }); app.get('/data', (req, res) => { res.json({ message: 'Some data' }); }); app.listen(port, () => { console.log(`Server listening at http://localhost:${port}`); console.log('Ensure Datadog Agent with DogStatsD is running on the host.'); });
Debug
Known issues
breakingThe `connect-datadog` library is officially deprecated and its GitHub repository is auto-archived. Datadog strongly recommends migrating to Datadog APM for Node.js for comprehensive monitoring, as this library will receive no further updates and may not be compatible with future Node.js or Express versions.
fix
Migrate to Datadog's official APM client for Node.js (e.g., `dd-trace`) which provides automatic instrumentation and richer features. Refer to the Datadog APM documentation for Node.js.
affects: >=0.0.9
gotchaThis package has not been updated in over seven years (last published version 0.0.9). It may have compatibility issues with modern Node.js versions (e.g., Node.js 14+) and recent Express.js versions, potentially leading to unexpected behavior or runtime errors.
fix
It is strongly advised to use Datadog APM or a more actively maintained StatsD client for Node.js (like `hot-shots`) for new projects and consider migrating existing ones.
affects: 0.0.9
gotchaThe middleware relies on a running Datadog Agent with DogStatsD enabled on the host machine or a reachable network address. If the agent is not running or misconfigured, metrics will not be collected by Datadog.
fix
Ensure the Datadog Agent is installed, running, and DogStatsD is enabled. Verify network connectivity between your application and the DogStatsD UDP port (default 8125). Refer to Datadog Agent and DogStatsD setup documentation.
affects: >=0.0.1
deprecatedThe usage pattern `app.use(app.router);` shown in the original README is deprecated in modern Express.js versions. Routing middleware should typically be registered directly after global middleware, before defining specific routes.
fix
Remove the line `app.use(app.router);` from your application. In modern Express, routing is handled automatically and this line is unnecessary and can cause warnings or errors.
affects: 0.0.9 (when used with Express 4.x+)
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use `require()` in an ES module (ESM) context when `package.json` specifies `"type": "module"` or the file has a `.mjs` extension.
fix
This package is CommonJS-only. To use it in an ESM project, you might need a wrapper or dynamic import, but it's strongly recommended to migrate to a modern, ESM-compatible Datadog APM client (e.g., `dd-trace`) instead.
Metrics are not appearing in Datadog dashboards for my Express application.
The Datadog Agent with DogStatsD might not be running, or there's a network issue preventing the application from sending UDP packets to the agent.
fix
Verify the Datadog Agent is installed and running on your host. Check the Agent's logs for DogStatsD errors. Confirm that UDP port 8125 (default) is open and reachable by your application. Ensure the `dogstatsd` client configured in `connect-datadog` points to the correct host and port if not using defaults.
TypeError: app.router is deprecated, you should probably just remove it.
The quickstart example `app.use(app.router);` is an outdated practice from older Express.js versions.
fix
Remove the line `app.use(app.router);` from your application. In modern Express, routing is handled automatically and this line is unnecessary and can cause warnings or errors.
Upgrade
Version history
0.0.9latest on npm
Audit
Dependencies
node-dogstatsdrequiredInternal client for sending metrics to DogStatsD agent. It is a direct dependency used by the middleware.
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
connect-datadog — npm install connect-datadog · libregistry