function getSampleReport() {
var counter = new Counter();
counter.inc(5);
var timer = new Timer();
for (var i = 1; i <= 100; i++) {
timer.update(i);
}
var meter = new Meter();
meter.mark(10);
var hist = new Histogram();
for (var i = 1; i <= 100; i++) {
hist.update(i*2);
}
var gauge = new CachedGauge(function () {
return 0.8
}, 10000);
var report = new Report();
report.addMetric("basicCount", counter);
report.addMetric("myapp.Meter", meter);
report.addMetric("myapp.Timer", timer);
report.addMetric("myapp.Histogram", hist);
report.addMetric("myapp.Gauge", gauge);
return report;
}
4. Checkout graphite browser at `localhost:8080`
![image](https://user-images.githubusercontent.com/5904910/49378668-76871580-f70d-11e8-8d30-3a9b46bc97d0.png)
The Gauge folder is missing from graphite, i.e. gauge data was not sent to graphite container
The gauge metric is not working with the graphite_reporter.
To recreate the issue:
Run graphite container:
Send some metrics to the graphite container, using
getSampleReport
fromhelper.js
intest/usint
:function getSampleReport() { var counter = new Counter(); counter.inc(5); var timer = new Timer(); for (var i = 1; i <= 100; i++) { timer.update(i); } var meter = new Meter(); meter.mark(10); var hist = new Histogram(); for (var i = 1; i <= 100; i++) { hist.update(i*2); } var gauge = new CachedGauge(function () { return 0.8 }, 10000); var report = new Report(); report.addMetric("basicCount", counter); report.addMetric("myapp.Meter", meter); report.addMetric("myapp.Timer", timer); report.addMetric("myapp.Histogram", hist); report.addMetric("myapp.Gauge", gauge); return report; }
const report = getSampleReport(); const reporter = new metrics.GraphiteReporter(report, "test", "localhost", 2003); reporter.start(1000);
node test.js