This entry describes `node-statsd`, a client library for sending metrics to a StatsD server from Node.js applications. The specific version provided, 0.1.1, is exceptionally old, predating the 1.0.0 release. The package allows sending common StatsD metric types such as timings, increments, decrements, histograms, and gauges over UDP. It offers basic configuration for host, port, prefix, suffix, and optional global tags. Due to its age (last significant update over 7 years ago, with the provided version being even older), this client is considered largely abandoned. Modern Node.js applications should consider more actively maintained alternatives like `hot-shots` or `statsd-client` which offer broader compatibility, better error handling, and more features. The release cadence for this specific package is effectively non-existent.
npm install node-statsdVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing the StatsD client with optional parameters and sending various metric types like timing, increment, gauge, histogram, and set, including basic socket error handling.
Migrate to a currently maintained StatsD client library for Node.js, such as `hot-shots` or `statsd-client`. These alternatives offer better support for modern Node.js, ESM, and ongoing maintenance.
Be aware of UDP's inherent unreliability. For critical metrics requiring guaranteed delivery, StatsD (and by extension this client) is not the appropriate tool. Consider logging directly or using a reliable message queue.
Ensure your project uses CommonJS `require()` for this package. If your project is ESM-first, you will need to use a CommonJS wrapper or, preferably, migrate to an ESM-compatible StatsD client.
Always implement error listeners on `client.socket` and use the optional `callback` parameter for critical metric submissions to gracefully handle transmission errors.
Ensure the package is installed via `npm install node-statsd`. Verify the `require` path is correct as `require('node-statsd')`. If using a modern Node.js environment, consider if you accidentally installed a different StatsD client or if your project configuration is mixing CJS/ESM.Check network connectivity to the StatsD host and port. Verify firewall rules allow UDP traffic on the specified port (default 8125). Ensure the user running the Node.js application has appropriate network permissions. Double-check `host` and `port` configuration options.
Verify that `const StatsD = require('node-statsd');` executed successfully and `new StatsD()` returned an object. Check your `node_modules` directory for `node-statsd` to ensure it's correctly installed. Restart your application to clear any module cache issues.No dependency data recorded yet.