{"id":18334,"library":"express-hot-shots","title":"express-hot-shots","description":"Simple Express/Connect middleware for StatsD route monitoring that sends status codes and response times per route. Version 1.0.2 is the latest stable release (last updated in 2018). Key differentiators: lightweight, fork of uber/express-statsd with support for tags and per-route keys via req.statsdKey and req.statsdTags. Works with plain HTTP servers, not just Express. Release cadence: sporadic, no updates since initial release.","status":"maintenance","version":"1.0.2","language":"javascript","source_language":"en","source_url":"git://github.com/withspectrum/express-hot-shots","tags":["javascript","connect","express","statsd","monitoring"],"install":[{"cmd":"npm install express-hot-shots","lang":"bash","label":"npm"},{"cmd":"yarn add express-hot-shots","lang":"bash","label":"yarn"},{"cmd":"pnpm add express-hot-shots","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for sending StatsD metrics; express-hot-shots wraps hot-shots but does not list it as a peer dependency.","package":"hot-shots","optional":false}],"imports":[{"note":"CommonJS require works correctly; ESM import may need default interop.","wrong":"const statsdMiddleware = require('express-hot-shots')","symbol":"default","correct":"import statsdMiddleware from 'express-hot-shots'"},{"note":"HotShots is not exported by express-hot-shots; it must be imported from 'hot-shots' directly.","wrong":"const HotShots = require('express-hot-shots').HotShots","symbol":"HotShots","correct":"import { HotShots } from 'hot-shots'"},{"note":"The exported default is a factory function that returns middleware, not a constructor.","wrong":"new statsdMiddleware({ client: myHotShotsInstance })","symbol":"middleware factory call","correct":"statsdMiddleware({ client: myHotShotsInstance })"}],"quickstart":{"code":"import express from 'express';\nimport statsdMiddleware from 'express-hot-shots';\nconst app = express();\napp.use(statsdMiddleware({\n  hotShots: {\n    host: process.env.STATSD_HOST || 'localhost',\n    port: parseInt(process.env.STATSD_PORT || '8125')\n  }\n}));\napp.get('/api/hello', (req, res) => {\n  req.statsdKey = ['http', req.method.toLowerCase(), 'hello'].join('.');\n  res.send('Hello World!');\n});\napp.listen(3000);","lang":"javascript","description":"Shows how to set up express-hot-shots with Express, configure StatsD host/port, and use per-route keys via req.statsdKey."},"warnings":[{"fix":"Always set req.statsdKey before the response is sent, e.g., in a per-route middleware.","message":"If you don't set req.statsdKey, metrics will use a generic 'status_code' and 'response_time' key without route context.","severity":"gotcha","affected_versions":"all"},{"fix":"Run: npm install hot-shots","message":"express-hot-shots requires the 'hot-shots' package to be installed separately; it is not included as a dependency.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using alternatives like 'express-statsd' or direct integration with 'hot-shots'.","message":"This package has not been updated since 2018 and may have compatibility issues with modern Express versions.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Set req.statsdKey in a middleware that runs before any other middleware that sends the response.","message":"The middleware only sends metrics after the response is finished; setting req.statsdKey in the route handler after calling next may not apply if the response is sent later.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install hot-shots: npm install hot-shots","cause":"hot-shots is not listed as a dependency of express-hot-shots.","error":"Cannot find module 'hot-shots'"},{"fix":"Call the default export: statsdMiddleware(options) or import as default: import statsdMiddleware from 'express-hot-shots'","cause":"Using the import as a constructor or not calling the factory function.","error":"TypeError: statsdMiddleware is not a function"},{"fix":"Set req.statsdKey in a middleware before the route handler, e.g., req.statsdKey = 'http.get.home';","cause":"Failing to set req.statsdKey before response.","error":"req.statsdKey is not set, metrics have generic names"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}