etsy/statsd-jvm-profiler

Why use a gauge for time measures?

Closed this issue · 2 comments

Hi,
I wonder why you use a gauge for recording the GC run time, as opposed to a count or a timing measure. Does this not mean one value will be overwritten by the next measure, and the total time might be lost?

recordGaugeValue("gc." + gcMXBean.getName() + ".time", time);
recordGaugeValue("gc." + gcMXBean.getName() + ".runtime", runtime);

Any response or insight would be appreciated! Thanks!

The first metric there is the total time spent in GC up to the current time as recorded by the JVM, so we want to simply record the value at the time the profiler emits metrics.

The second metric is the amount of time spent in GC since the last time the profiler emitted metrics. There's no particular reason to use a gauge for this one and we certainly could use a timing measure instead, but we don't have to worry about the total time since the JVM is already doing that for us and we're recording it in a different metric.

Hope that helps!

Ok, that makes sense. Thank you.