Registry / observability / express-hot-shots

express-hot-shots

JSON →
library1.0.2jsnpmunverified

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.

npm install express-hot-shots
INSTALL
IMPORT
SIG · EXPRESS-HOT-SHOTS
E
express-hot-shots
observabilityjavascriptv1.0.2
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.

default
import statsdMiddleware from 'express-hot-shots'
const statsdMiddleware = require('express-hot-shots')
CommonJS require works correctly; ESM import may need default interop.
HotShots
import { HotShots } from 'hot-shots'
const HotShots = require('express-hot-shots').HotShots
HotShots is not exported by express-hot-shots; it must be imported from 'hot-shots' directly.
middleware factory call
statsdMiddleware({ client: myHotShotsInstance })
new statsdMiddleware({ client: myHotShotsInstance })
The exported default is a factory function that returns middleware, not a constructor.

Shows how to set up express-hot-shots with Express, configure StatsD host/port, and use per-route keys via req.statsdKey.

import express from 'express'; import statsdMiddleware from 'express-hot-shots'; const app = express(); app.use(statsdMiddleware({ hotShots: { host: process.env.STATSD_HOST || 'localhost', port: parseInt(process.env.STATSD_PORT || '8125') } })); app.get('/api/hello', (req, res) => { req.statsdKey = ['http', req.method.toLowerCase(), 'hello'].join('.'); res.send('Hello World!'); }); app.listen(3000);
Debug
Known issues
gotchaIf you don't set req.statsdKey, metrics will use a generic 'status_code' and 'response_time' key without route context.
fix
Always set req.statsdKey before the response is sent, e.g., in a per-route middleware.
affects: all
gotchaexpress-hot-shots requires the 'hot-shots' package to be installed separately; it is not included as a dependency.
fix
Run: npm install hot-shots
affects: all
deprecatedThis package has not been updated since 2018 and may have compatibility issues with modern Express versions.
fix
Consider using alternatives like 'express-statsd' or direct integration with 'hot-shots'.
affects: >=1.0.0
gotchaThe 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.
fix
Set req.statsdKey in a middleware that runs before any other middleware that sends the response.
affects: all
Errors
Common errors & fixes
Cannot find module 'hot-shots'
hot-shots is not listed as a dependency of express-hot-shots.
fix
Install hot-shots: npm install hot-shots
TypeError: statsdMiddleware is not a function
Using the import as a constructor or not calling the factory function.
fix
Call the default export: statsdMiddleware(options) or import as default: import statsdMiddleware from 'express-hot-shots'
req.statsdKey is not set, metrics have generic names
Failing to set req.statsdKey before response.
fix
Set req.statsdKey in a middleware before the route handler, e.g., req.statsdKey = 'http.get.home';
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
hot-shotsrequiredRequired for sending StatsD metrics; express-hot-shots wraps hot-shots but does not list it as a peer dependency.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
2
Resources
express-hot-shots — npm install express-hot-shots · libregistry