npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

metricify

2.0.1 • Public • Published

metricify

Metrics Done Easy

npm version dependencies Build Status Pledge To Arupex! lifetimeDownloadCount

Install

    npm install metricify --save

Usage

    function optionalCallbackOnAllMetersFinish(meterResult){
        console.log(JSON.stringify(meterResult, null, 3));
    }

    var Metrics = require('metricify');

    var factory = new Metrics(optionalCallbackOnAllMetersFinish);

    var myMeter = factory.meter('myMeter');

    //do some stuff
    for(var i = 0; i < 10000; ++i){}

    myMeter.end();


    //factory.getMeters(); returns meter min/max and data points

    //factory.calcMetrics(); //returns detailed stats using stats-lite

Promises

// creates a meter that starts at function call, and ends when promise is resolved
// lets you force the scope incase your function calls assuming some scope
factory.promiseMeter('my-meter-name', functionThatResultsInPromise, argumentsToFunctionCallAsArray, forceScope)

install

npm i metricify

Downloadsweekly downloads

5

version

2.0.1

license

UNLICENSED

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability