Hot Shots is a robust and actively maintained Node.js client designed for sending metrics to StatsD, DogStatsD (Datadog), Telegraf, and OpenTelemetry Collector StatsD receivers. As of version 14.3.1, it provides comprehensive support for various protocols including UDP, Unix Domain Sockets (UDS), and TCP, catering to diverse deployment environments. The library differentiates itself from its `node-statsd` origin by offering advanced features such as TypeScript types, raw stream protocol, child clients for scoped metrics, mock mode for testing without real sockets, and asynchronous timer methods. It is regularly updated, with a stable release cadence, and requires Node.js 18.x or higher, and TypeScript 4.0+ for its type definitions. Its extensive configuration options allow for fine-grained control over host, port, prefixes, suffixes, global tags, and automatic Datadog tag inclusion from environment variables.
npm install hot-shotsVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing a StatsD client with common options, sending various metric types (increment, gauge, timer), and sending a DogStatsD event. It also includes proper client cleanup.
Upgrade your Node.js environment to version 18.x or later.
Upgrade your TypeScript compiler to version 4.0 or later.
Only use `mock: true` for testing purposes and ensure `mockBuffer` is periodically cleared or reset if tests generate a large volume of metrics.
Avoid using `tagPrefix` or `tagSeparator` when configuring the client for Telegraf. Telegraf's tag handling is automatic based on its protocol.
Always explicitly set the `host` option, or ensure `DD_AGENT_HOST` is correctly configured in your environment, to avoid metrics being sent to an unintended local address.
Verify the `host` option in your StatsD client configuration. Ensure the hostname is correct, the DNS server is reachable, or the IP address is valid and the agent is running.
For ESM, use `import StatsD from 'hot-shots';`. For CommonJS, use `const StatsD = require('hot-shots');`. Do not use destructuring or named imports for the main `StatsD` class.Ensure `hot-shots` is installed (`npm install hot-shots`) and your `tsconfig.json` is correctly configured to include `node_modules/@types` (usually by default) and a TypeScript version of 4.0 or higher.
Double-check the `host`, `port`, and `protocol` options in your `hot-shots` client configuration. Verify that the StatsD agent is running and listening on the specified port and that no firewall rules are preventing communication.
No dependency data recorded yet.