Gauge not working with graphite reporter
ankitchiplunkar opened this issue · comments
Ankit Chiplunkar commented
The gauge metric is not working with the graphite_reporter.
To recreate the issue:
- Run graphite container:
docker run \
-d \
--name graphite \
--restart=always \
--network host\
-p 80:80 \
-p 8080:8080 \
-p 2003-2004:2003-2004 \
-p 2023-2024:2023-2024 \
-p 8125:8125/udp \
-p 8126:8126 \
-v /tmp/data/graphite/configs:/opt/graphite/conf \
-v /tmp/data/graphite/data:/opt/graphite/storage \
-v /tmp/data/graphite/statsd:/opt/statsd \
graphiteapp/graphite-statsd
- Send some metrics to the graphite container, using
getSampleReport
fromhelper.js
intest/usint
:
const metrics = require("metrics"),
Report = metrics.Report,
Counter = metrics.Counter,
Timer = metrics.Timer,
Meter = metrics.Meter,
Histogram = metrics.Histogram,
CachedGauge = metrics.CachedGauge
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);
- Run the test and send data to graphite
node test.js
- Checkout graphite browser at
localhost:8080
The Gauge folder is missing from graphite, i.e. gauge data was not sent to graphite container
Andrew Tolbert commented
Fixed by #65 and released in v0.1.20, thank you!