New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

metricador

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

metricador

Core library to add performance metrics to your Node.js application.

  • 0.3.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status codecov.io david-dm Inline docs Code Climate

Metricador

Core library to add performance metrics to your Node.js application. Supports using metric implementations such as Counters and Histograms to send data over to specialized backends (such as Graphite).

Usage

Top level of your app:

var metricador = require('metricador');

var metricRegistry = metricador.registry;
var metricPublishers = [
  metricador.publishers.console.json.get(registry),
  metricador.publishers.graphite.json.get(registry, '<hostname_or_ip_of_Graphite_server>')
];
var metricReporter = new metricador.Reporter(metricPublishers);

Inside one of your app controllers:

var metricador = require('metricador');

var metricRegistry = metricador.registry;
var hitCounter = metricRegistry.counter("myapp.controllers.registration.hits");
var responseTimes = metricRegistry.histogram("myapp.controllers.registration.responsetimes");

// ...Business logic...
hitCounter.incrementAndGet();
responseTimes.update(timeElapsed);

Every 30 seconds the reporter will output something similar to the standard console:

{
  'myapp.controllers.registration.hits': 3401,
  'myapp.controllers.registration.responsetimes.0_100': 2001,
  'myapp.controllers.registration.responsetimes.100_250': 2400,
  'myapp.controllers.registration.responsetimes.250_500': 230,
  'myapp.controllers.registration.responsetimes.500_1000': 20,
  'myapp.controllers.registration.responsetimes.1000_1500': 1,
  'myapp.controllers.registration.responsetimes.1500_Inf': 3
}

Since we registered a Graphite publisher it will also send the data to the Graphite server for plotting.

License

MIT

Keywords

FAQs

Package last updated on 08 Feb 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc