statsd-parser is a Node.js library designed for streaming parsing of the StatsD protocol. It provides both a low-level `parser()` object for direct event-driven parsing and a higher-level `createStream()` API for integrating with Node.js streams, allowing for efficient processing of StatsD metrics from various input sources like network streams or files. The library was last updated in September 2013, with its current and only published version being 0.0.4. Due to its age and lack of maintenance for over a decade, it is not recommended for new projects or existing systems requiring modern Node.js compatibility, security updates, or active support. Key differentiators at the time of its release included its focus on streaming capabilities and event-driven parsing, which was beneficial for handling high-volume metric data efficiently in a Node.js environment.
npm install statsd-parserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates both the direct `parser` API and the `createStream` API for processing StatsD metric strings. It shows error handling and how to receive parsed metric objects.
Migrate to an actively maintained StatsD parsing library or a comprehensive observability solution. Examples include `node-statsd-client` (for sending), `telegraf` (for receiving/parsing as a daemon), or modern observability platforms like OpenTelemetry, Prometheus, or Datadog which often include robust StatsD parsing capabilities.
Ensure you are using `require()` for importing the library in your Node.js application: `const statsd_parser = require('statsd-parser');`Implement the recommended error clearing and resumption logic within your `stream.on('error')` handler to maintain stream resilience:
```javascript
stream.on("error", function (e) {
console.error("Error parsing line:", e.message);
this._parser.error = null; // Clear internal parser error state
this._parser.resume(); // Allow parser to continue processing
});
```Use the standard CommonJS pattern: `const statsd_parser = require('statsd-parser'); const parser = statsd_parser.parser();`Change your import statement to `const statsd_parser = require('statsd-parser');`Ensure the upstream network client or source sending data handles connection stability. For `statsd-parser`, implement robust error handling on the stream (`stream.on('error')`) as shown in the quickstart, and consider using more modern, robust stream processing libraries or network handlers if connection issues are frequent.No dependency data recorded yet.