Support gauge delta
Hi,
apparently, statsd supports sending deltas for gauges. Sifting through the code, it doesn't look like deltas are supported at the moment. Is this a known issue, an oversight, or an intentional design choice?
If desired, I can submit a PR myself when I find the time.
Cheers, Dom
Hi @dpetrick this is actually by design, see the docs at https://docs.datadoghq.com/guides/dogstatsd/ and this issue detailing when we decided not to support the feature: https://github.com/DataDog/dd-agent/pull/2104
If delta isn't supported, how will one be able to measure something like current active users logged in to the application or number of active DB connections open? We would also want to decrement when someone logs out of the application, or when the DB connection is closed. How is that done? Can you help us understand? We use Telegraf and Influx as the backend.
@prasadasokan I'm accomplishing this with a Java AtomicInteger to manually track my total, updateAndGet to modify it, and then send the resulting total as my gauge value. I'm sure most runtimes have similar capability. But totally agree that a way to send gauge deltas natively would be really nice. If I were making really high volume changes, there could be contention for my count variable and performance impact.
@acjay What happens if your service restarts?
@lostcolony Not at the same company anymore, but as this was for a live connection count on web sockets, all the clients would have to reestablish their connections from zero, anyway. But yeah, I can see how this wouldn't work for all situations.
I was looking to migrate my client from the tim-group/java-statsd-client to this one, but I'm currently using the other client's recordGaugeDelta method, which this client doesn't implement. That method has been working fine for me. Can't that implementation just be copied over to this one so it doesn't break things for those of us who are looking to migrate over to this one?