Skip to content

Instantly share code, notes, and snippets.

@camshaft
Last active December 15, 2015 09:49
Show Gist options
  • Save camshaft/5240954 to your computer and use it in GitHub Desktop.
Save camshaft/5240954 to your computer and use it in GitHub Desktop.
metric middleware
/**
* Module dependencies
*/
var metric = require("metric-log");
module.exports = function() {
// TODO what do we inherit from?
var parent = metric.context();
return function metricLogger(req, res, next) {
req.metric = metric.context({
request_id: req.get("Heroku-Request-ID")
}).use(parent);
next();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment