Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gauge not working with graphite reporter #64

Closed
ankitchiplunkar opened this issue Dec 3, 2018 · 1 comment
Closed

Gauge not working with graphite reporter #64

ankitchiplunkar opened this issue Dec 3, 2018 · 1 comment

Comments

@ankitchiplunkar
Copy link
Contributor

The gauge metric is not working with the graphite_reporter.

To recreate the issue:

  1. 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
  1. Send some metrics to the graphite container, using getSampleReport from helper.js in test/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);
  1. Run the test and send data to graphite
node test.js
  1. Checkout graphite browser at localhost:8080

image

The Gauge folder is missing from graphite, i.e. gauge data was not sent to graphite container

@tolbertam
Copy link
Collaborator

Fixed by #65 and released in v0.1.20, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants