This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

wavefrontmetrics

1.1.4 • Public • Published

Wavefront reporters for metrics travis build status

A node.js Wavefront reporters for metrics.

Installation

$ npm install wavefrontmetrics

Usage

Wavefront Reporters

const metrics = require('wavefrontmetrics');
const registry = new metrics.Registry();
 
// Report directly to a Wavefront server
const directReporter = new metrics.WavefrontDirectReporter(registry, "wavefront.nodejs.direct", "<cluster>.wavefront.com", "<wavefront_api_token>", { "tag0": "default", "source": "wavefront-nodejs-example"});
directReporter.start(5000);
 
// Report to a Wavefront proxy
const proxyReporter = new metrics.WavefrontProxyReporter(registry, "wavefront.nodejs.proxy", "localhost", 2878, { "tag0": "default", "source": "wavefront-nodejs-example"});
proxyReporter.start(5000);

Metrics

const metrics = require('wavefrontmetrics');
const registry = new metrics.Registry();
 
// Counter with metric level tags
let c = new metrics.Counter();
registry.addTaggedMetric("request.counter", c, {"key1":"val1"});
c.inc();
 
// Gauge with metric level tags
// Note that you can only pass in a function to a Gauge.
var g = new metrics.Gauge(() => { 
  return 2 + Math.random(5);
});
registry.addTaggedMetric("request.gauge", g, {"key1":"val1"});
 
// Histogram
let h = new metrics.Histogram();
registry.addTaggedMetric("request.duration", h, {"key1":"val1"});
h.update(50);
 
// Meter
let m = new metrics.Meter();
registry.addTaggedMetric("request.meter", m, {"key1":"val1"});
m.mark(1);
 
// Timer
let t = new metrics.Timer();
registry.addTaggedMetric("request.timer", t, {"key1":"val1"});
t.update(50);

DeltaCounter

const metrics = require('wavefrontmetrics');
const registry = new metrics.Registry();
 
let deltaCounter = new metrics.Counter();
let deltaName = metrics.deltaCounterName("http.requests");
registry.addTaggedMetric(deltaName, deltaCounter, {"key1":"val1"});
deltaCounter.inc(10);

Package Sidebar

Install

npm i wavefrontmetrics

Weekly Downloads

237

Version

1.1.4

License

MIT

Unpacked Size

27 kB

Total Files

14

Last publish

Collaborators

  • aliu-vmware
  • paragsanghavi
  • wavefrontbyvmware
  • yesyzq