node-datadog-metrics icon indicating copy to clipboard operation
node-datadog-metrics copied to clipboard

Flushing the same metric multiple times in the same second overwrites previous values

Open scmorse opened this issue 4 years ago • 2 comments

If you increment a counter, flush the message, and then before the UTC timestamp has rolled into the next second, increment the same counter with the same tags (and flush again), only one of your two increments will show up in datadog. I think Datadog has some de-duplication / unique indexing that only tracks a unique metric per second. I think this library would need to keep in-memory up to 1 second of messages, to be able to track and send the right stats.

scmorse avatar Jun 29 '20 14:06 scmorse

@scmorse we were seeing that same issue with this library. Since it seems to have been abandoned we've switched to datadog-lambda-js and have had better results.

eeubank avatar Sep 18 '20 13:09 eeubank

I just finished a PR that adds distribution metrics, which won’t have this problem (datadog-lambda-js only sends distributions, which is how it works around this issue). If the core issue here is still causing you problems and doesn’t get addressed before the next release, you might try using a distribution instead.

Mr0grog avatar Sep 19 '22 22:09 Mr0grog