node package manager

better-metrics

This is an alternative port of Coda Hale's metrics library.

better-metrics

This is an alternative port of Coda Hale's metrics library.

I created this because I did not like the existing metrics port, which makes too many (bad) assumptions that aren't present in the original library. However, this is not a 1:1 port either as I have tried to use node idioms for most things.

Usage

Here is a simple example that measures the requests / second for a http server:

var metrics = require('better-metrics'));
var meter   = new metrics.Meter();
 
var http = require('http');
http.createServer(function(req, res) {
  meter.mark();
  res.end('Thanks');
}).listen(3000);

Now this just measures things, but does not give you any way to look at the results. But fear not, logging this information is really simple:

setTimeout(function() {
  console.log(meter.toJSON());
}, 1000);

This will print something like this:

Todo

  • Finish Readme : )
  • Re-write Histogram and involved classes, took them from the original metrics library as I had to get those ready in a hurry for something : ).