Clarity on how to use StatsD Gauges

May be dumb question. Can someone help me understand how to drop a measurement that is of metric type gauge and the config to reset gauge is set as false?

We want this reset gauge to be set to false as we would like to use the last value as the value to measure something.

With this approach, when gauge delta is sent, we are able to get the desired value when sent from Python. We have the following questions.

  1. How do we drop the measurement? When we try, it is dropped, but the last known value is written again making it a ever lasting measurement.
  2. How can we stop it from printing the last known value for every interval, even when no metrics is sent?

Thanks in advance.

You will have to use the delete_gauges = true option. When you say reset gauge is false are you referring to this option? This option will prevent the previous aggregation periods value from being sent if the gauge is not set again.

Yes, this is the option I’m referring to. If this value is set to true, actual delta values are saved as it is and one has to sum them to arrive at the current value.

Assume we send 0 as the initial value and then send +100 and then -9, when true, you get 0,100,-9 and one has to sum it up to find the value as 91.

With false, 0,100,91 it becomes and last value can be used to find the current state. But we are not able to stop that value from being printed again and again and not able to drop the measurement. Even if you drop, it creates the measurement again.

Is this expected?

If true, it becomes almost similar to counter right? Then where is gauge useful?

This sounds right to me, we are trying to mimic etsy/statsd behavior. Here is what their documentation says:

deleteIdleStats: don’t send values to graphite for inactive counters, sets, gauges, or timers
as opposed to sending 0. For gauges, this unsets the gauge (instead of sending
the previous value). Can be individually overriden. [default: false]

deleteGauges: don’t send values to graphite for inactive gauges, as opposed to sending the previous value [default: false]

I normally use gauges when reporting values that are absolute, such as a file size or the number of items in a queue, this way the application doesn’t need to report on the same reporting interval as the statsd server like it would need to do with a counter. Reporting values that are absolute also allows the same value to be reported by multiple clients without issue.

I can’t honestly think of a time I used relative values with a gauge. I agree using relative values with a gauge seems a lot like a counter, especially with delete gauges true.