JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q49868F
  • License Apache-2.0

A library to instrument your node application for Graphite reporting

Package Exports

  • node-instrument

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-instrument) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-instrument

Library to instrument your node application for graphite reporting

Installation

npm install jdbranham/node-instrument

Usage

var instrument = require('node-instrument')();

Options

var options = {
    carbonHost : '127.0.0.1',
    carbonPort : 2003,
    type : 'udp4',
    prefix : '',
    suffix : '',
    verbose : false,
    interval : 5000,
    callback : null
};

Manual Reporting

var instrument = require('node-instrument')({prefix: 'localhost'});
instrument.addObject({myMetric: 1});
instrument.send();

Automated Interval Reporting

var instrument = require('node-instrument')({prefix: 'localhost'});
instrument.start();
instrument.addObject({myMetric: 1});

When using the interval reporting, the 'put' and 'add' methods act slightly different.
put and putObject - replaces the value of a metric if it already exists in the queue.
add and addObject - adds the metric value to any existing metric in the queue.

Name/Value metrics

instrument.add('server.metric1', 1);

Object/nested metrics

instrument.addObject({myMetric: 1});
// or
instrument.addObject({myMetric: {sub: 1}});
// or 
instrument.addObject({myMetric: {sub: 1}, 
                                deep: {
                                   down: 1
                                   }
                                });