{"_id":"express-statsd","_rev":"12-f019bddad58395a4410b7d0ad82aeb29","name":"express-statsd","description":"Statsd route monitoring middleware for connect/express","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"express-statsd","description":"Statsd route monitoring middleware for connect/express","version":"0.1.0","homepage":"https://github.com/uber/express-statsd","author":{"name":"Matt Morgan","email":"matt@mlmorg.com","url":"http://mlmorg.com"},"keywords":["connect","express","statsd","lynx","monitoring"],"repository":{"type":"git","url":"git://github.com/uber/express-statsd.git"},"bugs":{"url":"https://github.com/uber/express-statsd/issues"},"licenses":[{"type":"MIT","url":"https://github.com/uber/express-statsd/blob/master/LICENSE"}],"main":"lib/express-statsd","dependencies":{"lynx":"~0.0.11","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"},"_id":"express-statsd@0.1.0","dist":{"shasum":"5d46d99c9a07cfc9018d40a8c24734552a9b7f82","tarball":"https://registry.npmjs.org/express-statsd/-/express-statsd-0.1.0.tgz","integrity":"sha512-0EeETOFP1D21DuBVvvc5CfJ/kWjYLmJ6B+aP+99efofP4pKh31dKdUErzLGFim6fQkdCrRK+zdkXlyXpdutlOg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDiI3FioE/eqXXiQM3C9/+78ROivRDtBnYG2nkK5QqHNAIgRNlDVb+2wL97VM7u2XVHtZHybMa1b6MS7dVunjPRzZw="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"mlmorg","email":"matt@mlmorg.com"},"maintainers":[{"name":"mlmorg","email":"matt@mlmorg.com"}]},"0.2.0":{"name":"express-statsd","description":"Statsd route monitoring middleware for connect/express","version":"0.2.0","homepage":"https://github.com/uber/express-statsd","author":{"name":"Matt Morgan","email":"matt@mlmorg.com","url":"http://mlmorg.com"},"keywords":["connect","express","statsd","lynx","monitoring"],"repository":{"type":"git","url":"git://github.com/uber/express-statsd.git"},"bugs":{"url":"https://github.com/uber/express-statsd/issues"},"licenses":[{"type":"MIT","url":"https://github.com/uber/express-statsd/blob/master/LICENSE"}],"main":"lib/express-statsd","dependencies":{"lynx":"~0.0.11","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"},"_id":"express-statsd@0.2.0","dist":{"shasum":"099ba01813754c8736b95206cb4e12eb7f2bd2e2","tarball":"https://registry.npmjs.org/express-statsd/-/express-statsd-0.2.0.tgz","integrity":"sha512-qIkaG/IOg1CYv31Jy3h5qng7BG8kQ7DmM2L3VgrC5vED0/Kz8xcH2EoY0QK2NUjQb9T7YSOj8jFU6wsjbG8fPQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGrCKJ21AoNt8VnleuW6n5phjPWCu9i/LoBb76oVkm3gIgWfTAcZH2oV77KbH/M/juHlIW4O6RH1VESqQNYk7GiSQ="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"mlmorg","email":"matt@mlmorg.com"},"maintainers":[{"name":"mlmorg","email":"matt@mlmorg.com"}]},"0.3.0":{"name":"express-statsd","description":"Statsd route monitoring middleware for connect/express","version":"0.3.0","homepage":"https://github.com/uber/express-statsd","author":{"name":"Matt Morgan","email":"matt@mlmorg.com","url":"http://mlmorg.com"},"keywords":["connect","express","statsd","lynx","monitoring"],"repository":{"type":"git","url":"git://github.com/uber/express-statsd.git"},"bugs":{"url":"https://github.com/uber/express-statsd/issues"},"licenses":[{"type":"MIT","url":"https://github.com/uber/express-statsd/blob/master/LICENSE"}],"main":"lib/express-statsd","dependencies":{"lynx":"~0.0.11","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"},"_id":"express-statsd@0.3.0","dist":{"shasum":"cb60b8e4f633adc7eaaefb5819698b469c00b1bd","tarball":"https://registry.npmjs.org/express-statsd/-/express-statsd-0.3.0.tgz","integrity":"sha512-8X6mOFq4Yd6A0Sf6xwMi3Zo9UdVTyQdcY5OMEOzLj5sFapXCcM0ZOZ+zVVThP3SmMReRK5N/QZ69gkmKnbhkVQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAshrFi5vJSHLNIb+egLkuTQZ1tXhm6wjI6os09Fhmb3AiEAqRCy8/iXhgG93gxDWE1NdycanZJhLrgp6fNXWkCCuBo="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"mlmorg","email":"matt@mlmorg.com"},"maintainers":[{"name":"mlmorg","email":"matt@mlmorg.com"}]}},"readme":"# express-statsd [![Build status](https://travis-ci.org/uber/express-statsd.png?branch=master)](https://travis-ci.org/uber/express-statsd)\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\n## Installation\n\n``` bash\nnpm install express-statsd\n```\n\n## Usage\n\nAn example of an express server with express-statsd:\n\n``` js\nvar express = require('express');\nvar expressStatsd = require('express-statsd');\nvar app = express();\n\napp.use(expressStatsd());\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-statsd 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-statsd');\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### Plain http example\n\nThis module also works with any `http` server\n\n```js\nvar http = require('http');\nvar expressStatsd = require('express-statsd');\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** `Object` - The statsd client. Defaults to [lynx](https://github.com/dscape/lynx)\nwith host set to `127.0.0.1` and port set to `8125`.\n  - **requestKey** `String` - The key on the `req` object at which to grab\nthe key for the statsd logs. Defaults to `req.statsdKey`.\n","maintainers":[{"name":"mlmorg","email":"matt@mlmorg.com"}],"time":{"modified":"2022-06-17T22:41:06.306Z","created":"2014-01-31T01:00:15.763Z","0.1.0":"2014-01-31T01:00:16.224Z","0.2.0":"2014-02-12T19:31:55.933Z","0.3.0":"2014-02-12T23:50:29.246Z"},"readmeFilename":"README.md","author":{"name":"Matt Morgan","email":"matt@mlmorg.com","url":"http://mlmorg.com"},"repository":{"type":"git","url":"git://github.com/uber/express-statsd.git"},"users":{"jorgenevens":true}}