{"_id":"express-hot-shots","_rev":"2-046d4ed169f828dc0c01d4ce2e25fcf9","name":"express-hot-shots","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.1":{"name":"express-hot-shots","description":"Statsd route monitoring middleware for connect/express","version":"1.0.1","homepage":"https://github.com/withspectrum/express-hot-shots","author":{"name":"Max Stoiber"},"keywords":["connect","express","statsd","monitoring"],"repository":{"type":"git","url":"git://github.com/withspectrum/express-hot-shots.git"},"bugs":{"url":"https://github.com/withspectrum/express-hot-shots/issues"},"licenses":[{"type":"MIT","url":"https://github.com/withspectrum/express-hot-shots/blob/master/LICENSE"}],"main":"lib/express-hot-shots","dependencies":{"hot-shots":"^5.9.2","obj-extend":"~0.1.0"},"devDependencies":{"chai":"~1.8.1","express":"~3.4.7","grunt":"~0.4.2","grunt-cli":"~0.1.11","grunt-contrib-jshint":"~0.7.2","mocha":"~1.15.1","request":"~2.29.0"},"scripts":{"test":"grunt && mocha -R spec"},"gitHead":"571f6954a9417944c53cc359424a6d5e6f2616c7","_id":"express-hot-shots@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.14.0","_npmUser":{"name":"mxstbr","email":"npm@mxstbr.com"},"dist":{"integrity":"sha512-P16fcHwnAthToVoQIDuIGAiKsq+1JuYxi9QbsycB2WepAPJ23GjMhGSSN0D0EyUpYqYQqmJ3rLO68lWAxLAZXQ==","shasum":"c5f48322f3407db867fe5906ea2428d4e83539f5","tarball":"https://registry.npmjs.org/express-hot-shots/-/express-hot-shots-1.0.1.tgz","fileCount":11,"unpackedSize":41210,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcD6MECRA9TVsSAnZWagAAR6UQAJSfZ+ZkQjAs65/AsNOS\nP39ABJBRvdqoia0lb4I34daUDj90aLyEyKO3y2tetv7M85Hy0+fc71pkNni+\nm9GkPX+YnNZY6hnd55OoNNx3o8JUunGnTFFln/qB8S6LgOXhn+8Gc37I6n/I\njqtkC8aNouGBt87q24JP/+4yiOw9JJsgNi2RH/5B4JafnBpEvN6knEiNrqOZ\nwl0Tp6RHA63pu+gkhBtBA7M7Kq2x4udOQ6KRv5877lgBK/f1poMqjGZMRKTm\nzG0+n4vl9hDEOfua6DcNKMPoi4MY8QBZ1OBkgowdPcp7VZcgYOLjxdETMg39\nHITEHayJJfwzlqyA2BHoctkzJYB2reIzffJP1KQ/lKy3P3cb14C8U8gtp7sV\nqKJNRD3CCsCAXVM/pAu1Bh5baXKup2BHtJcFUs9f87JG0tYu+QVooCk7g9nd\nwPp1tIlf4jkRGCJ9Fohmifq+dmyEGHiyaQQDA08+ZCtXXKRcXMDZMiigbMEI\nbSNWk+9HmVr4ae7d2xtzHJniwzYs7P+nFLB1n2n+4End4HjTDgXNBPgz4tfn\njx+ER1ol1bdb2yXXxWXUPBLHDIy2ING+40ZBgGg44OYdTDcI69cr3VhRHjD3\nOAxFCzt9FywdyE3H6tiWikIMgiir5VEPL1wh8q6XbMXt0VgSytgjZz4wjhSF\nqZZ7\r\n=Inrp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBtTW8RZ/Tzo2aidCCtet+Pa64QBchJ0Br+6M2tN6ZidAiEA96MQgprtCy/7CANrTUXDT5oKczoSmI5xiAq/QqhHtQ8="}]},"maintainers":[{"name":"mxstbr","email":"npm@mxstbr.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-hot-shots_1.0.1_1544528644127_0.9267273201642381"},"_hasShrinkwrap":false},"1.0.2":{"name":"express-hot-shots","description":"Statsd route monitoring middleware for connect/express","version":"1.0.2","homepage":"https://github.com/withspectrum/express-hot-shots","author":{"name":"Max Stoiber"},"keywords":["connect","express","statsd","monitoring"],"repository":{"type":"git","url":"git://github.com/withspectrum/express-hot-shots.git"},"bugs":{"url":"https://github.com/withspectrum/express-hot-shots/issues"},"licenses":[{"type":"MIT","url":"https://github.com/withspectrum/express-hot-shots/blob/master/LICENSE"}],"main":"lib/express-hot-shots","dependencies":{"hot-shots":"^5.9.2","obj-extend":"~0.1.0"},"devDependencies":{"chai":"~1.8.1","express":"~3.4.7","grunt":"~0.4.2","grunt-cli":"~0.1.11","grunt-contrib-jshint":"~0.7.2","mocha":"~1.15.1","request":"~2.29.0"},"scripts":{"test":"grunt && mocha -R spec"},"gitHead":"3149d7b4e0d038e680b1abfd4ff9bb21b1f78c9a","_id":"express-hot-shots@1.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.14.0","_npmUser":{"name":"mxstbr","email":"npm@mxstbr.com"},"dist":{"integrity":"sha512-EW/HoBhpTSaO0QCwcIHSQ2M39ugKr/l2jtH4+qRSCbFAc31qLsOlFt5TGXIGUmMyyb1ffv0kiFHDbaWCd21kzA==","shasum":"570c2d5f7c18b6e2c6d3fb48a0736e92af5ddc1d","tarball":"https://registry.npmjs.org/express-hot-shots/-/express-hot-shots-1.0.2.tgz","fileCount":11,"unpackedSize":41340,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcD6PgCRA9TVsSAnZWagAAyt8P/3OAYZu0EHXKmDdNnmXL\nBSoaV0MbxqevmG5QPeFCJRfS+7avpC+pt2cApAidxpd4THgzJI+u/t2/bKRJ\na5K/mai6OQa3m0Q+rzFbCJzDb4IaSlcXsVMrv4pqUhfIIQNxF5OYj+DtQtx1\nKWJPs/BkHhnSbQUhfA6NxXsaZinjf6Jf5zmE4SX6JEFfgdc0kJqqDfKpyxpk\nqmkLRRMR5mxcsDssQrUo6fCU7uCIpOu7BxJ4IqC/Ic2R/DJ05cfzBNRV8Haq\ngtVYX+tVV2HewqFh7grQFEyx1DmH1G6G5XS/gEhatEuj3vuJc6JJVlPZU3wp\nBU7SNydwU3dK6jKTVJmPA6g9tJ4c+R/XTVqhpzCqDbbXSm2DbV6n2By70dqM\nfwqKStn+CXxz7bFlBBnqkcZIXWEXfJ8i0u7bx3Q3oMgjH11Hl5mpxXbHUbx9\nP+YEzlFdeUOnGdWaKKB88cWqt+zHxj93Fd8aED7AH+nZ2RApCw5FAyitUQeB\nK/vPwwNAe0MABMmG7Zo+4zdxRRTVj5Hmlq9lxbdQaWy8sZinnnQ1BgvRXH0z\n3KITqr+2m3M/uOFaMim1oi026dKC6qQP2z4B9MtZm5lBSR0cZIuA0ZKV6c1/\ndJSFl3qnNPW8mM5R5Eq+EIpt7pQy+gF4HDWeHLE04O4+OGFolBWtC2suapHa\nMVE5\r\n=TEZt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC2/ayQQQ215vjYlyhdvjjFlvCy6VXKS9TO+3SIwPbnPgIhAN3EgDy/IxdhLhU4C1yDEOcWJ/wONQcxVwITCyy4dRpq"}]},"maintainers":[{"name":"mxstbr","email":"npm@mxstbr.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-hot-shots_1.0.2_1544528861253_0.05250253737308963"},"_hasShrinkwrap":false}},"time":{"created":"2018-12-11T11:44:04.127Z","1.0.1":"2018-12-11T11:44:04.255Z","modified":"2022-05-01T23:03:59.917Z","1.0.2":"2018-12-11T11:47:41.352Z"},"maintainers":[{"name":"mxstbr","email":"npm@mxstbr.com"}],"description":"Statsd route monitoring middleware for connect/express","homepage":"https://github.com/withspectrum/express-hot-shots","keywords":["connect","express","statsd","monitoring"],"repository":{"type":"git","url":"git://github.com/withspectrum/express-hot-shots.git"},"author":{"name":"Max Stoiber"},"bugs":{"url":"https://github.com/withspectrum/express-hot-shots/issues"},"readme":"# express-hot-shots\n\n[StatsD](https://github.com/etsy/statsd/) route monitoring middleware for \n[Connect](https://github.com/senchalabs/connect)/[Express](https://github.com/visionmedia/express).\nThis middleware can be used either globally or on a per-route basis (preferred)\nand sends status codes and response times to StatsD.\n\nForked from [uber/express-statsd](https://github.com/uber/express-statsd) for usage in [Spectrum](https://github.com/withspectrum/spectrum).\n\n## Installation\n\n``` bash\nnpm install express-hot-shots\n```\n\n## Usage\n\nAn example of an express server with express-hot-shots:\n\n``` js\nvar express = require('express');\nvar statsd = require('express-hot-shots');\nvar app = express();\n\napp.use(statsd());\n\napp.get('/', function (req, res) {\n  res.send('Hello World!');\n});\n\napp.listen(3000);\n```\n\nBy default, the middleware will send `status_code` and `response_time` stats\nfor all requests. For example, using the created server above and a request to\n`http://localhost:3000/`, the following stats will be sent:\n\n```\nstatus_code.200:1|c\nresponse_time:100|ms\n```\n\n### Per route example\n\nHowever, it's **highly recommended** that you set `req.statsdKey` which\nwill be used to namespace the stats. Be aware that stats will only be logged\nonce a response has been sent; this means that `req.statsdKey` can be\nset even after the express-hot-shots middleware was added to the chain. Here's an \nexample of a server set up with a more specific key:\n\n``` js\nvar express = require('express');\nvar expressStatsd = require('express-hot-shots');\nvar app = express();\n\nfunction statsd (path) {\n  return function (req, res, next) {\n    var method = req.method || 'unknown_method';\n    req.statsdKey = ['http', method.toLowerCase(), path].join('.');\n    next();\n  };\n}\n\napp.use(expressStatsd());\n\napp.get('/', statsd('home'), function (req, res) {\n  res.send('Hello World!');\n});\n\napp.listen(3000);\n```\n\nA GET request to `/` on this server would produce the following stats:\n\n```\nhttp.get.home.status_code.200:1|c\nhttp.get.home.response_time:100|ms\n```\n\n### Tags\n\nYou can set the tags of the metrics with the `req.statsdTags` property.\n\n```JS\n\nfunction statsd (path) {\n  return function (req, res, next) {\n    var method = req.method || 'unknown_method';\n    req.statsdKey = ['http', method.toLowerCase(), path].join('.');\n    req.statsdTags = {\n      server: process.env.SERVER_NAME,\n    }\n    next();\n  };\n}\n```\n\nThese will be sent with both the response time and status code metrics.\n\n### Plain http example\n\nThis module also works with any `http` server\n\n```js\nvar http = require('http');\nvar expressStatsd = require('express-hot-shots');\n\nvar monitorRequest = expressStatsd();\n\nhttp.createServer(function (req, res) {\n    monitorRequest(req, res);\n\n    // do whatever you want, framework, library, router\n    res.end('hello world');\n}).listen(3000);\n```\n\n## Options\n\n``` js\nexpressStatsd(options);\n```\n\n- **options** `Object` - Container for settings\n  - **client** `HotShots instance` - a custom hot shots instance\n  - **hotShots** `Object` - The hotShots options if you don't want to provide your own instance\n  - **requestKey** `String` - The key on the `req` object at which to grab\nthe key for the statsd logs. Defaults to `req.statsdKey`.\n","readmeFilename":"README.md"}