🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

better-metrics

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-metrics

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

0.0.5
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

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 : ).

FAQs

Package last updated on 07 Nov 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts