Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

measured-core

Package Overview
Dependencies
Maintainers
2
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

measured-core

A Node library for measuring and reporting application-level metrics.

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
416K
17.17%
Maintainers
2
Weekly downloads
 
Created
Source

Measured Core

The core measured library that has the Metric interfaces and implementations.

npm

Install

npm install measured-core

What is in this package

Metric Implemenations

The core library has the following metrics classes:

Gauge

Values that can be read instantly via a supplied call back.

SettableGauge

Just like a Gauge but its value is set directly rather than supplied by a callback.

CachedGauge

Like a mix of the regular and settable Gauge it takes a call back that returns a promise that will resolve the cached value and an interval that it should call the callback on to update its cached value.

Counter

Counters are things that increment or decrement.

Timer

Timers are a combination of Meters and Histograms. They measure the rate as well as distribution of scalar events.

Histogram

Keeps a reservoir of statistically relevant values to explore their distribution.

Meter

Things that are measured as events / interval.

Registry

The core library comes with a basic registry class

Collection

that is not aware of dimensions / tags and leaves reporting up to you.

Other

See The measured-core modules for the full list of exports for require('measured-core').

Usage

Step 1: Add measurements to your code. For example, lets track the requests/sec of a http server:

var http  = require('http');
var stats = require('measured').createCollection();

http.createServer(function(req, res) {
  stats.meter('requestsPerSecond').mark();
  res.end('Thanks');
}).listen(3000);

Step 2: Show the collected measurements (more advanced examples follow later):

setInterval(function() {
  console.log(stats.toJSON());
}, 1000);

This will output something like this every second:

{ requestsPerSecond:
   { mean: 1710.2180279856818,
     count: 10511,
     'currentRate': 1941.4893498239829,
     '1MinuteRate': 168.08263156623656,
     '5MinuteRate': 34.74630977619571,
     '15MinuteRate': 11.646507524106095 } }

Step 3: Aggregate the data into your backend of choice. Here are a few time series data aggregators.

  • Graphite
    • A free and open source, self hosted and managed solution for time series data.
  • SignalFx
    • An enterprise SASS offering for time series data.
  • Datadog
    • An enterprise SASS offering for time series data.

FAQs

Package last updated on 10 Jul 2020

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