Warning
VMware has ended active development of this project. this repository will no longer be updated.
A node.js Wavefront reporters for metrics.
$ npm install wavefrontmetrics
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);
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);
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);