java-dogstatsd-client icon indicating copy to clipboard operation
java-dogstatsd-client copied to clipboard

Support gauge delta

Open dpetrick opened this issue 8 years ago • 6 comments

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

dpetrick avatar Aug 01 '17 13:08 dpetrick

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

masci avatar Nov 13 '17 17:11 masci

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 avatar Feb 02 '18 13:02 prasadasokan

@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 avatar Apr 17 '18 21:04 acjay

@acjay What happens if your service restarts?

lostcolony avatar Dec 06 '18 21:12 lostcolony

@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.

acjay avatar Dec 07 '18 15:12 acjay

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?

LMojica avatar Jan 15 '20 21:01 LMojica