Netflix-Skunkworks / spectatord

A high performance metrics daemon
Apache License 2.0
24 stars 5 forks source link

monotonic counters should store values as uint64_t #87

Closed copperlight closed 3 months ago

copperlight commented 3 months ago

We have use cases in the environment, where monotonic counters are stored as unit64_t values, particularly for Open Connect Appliances. Since the monotonic counter data types in spectatord are convenience wrappers that help users avoid the need to calculate their own deltas, they should be uint64_t types here. The actual deltas that are calculated and sent to the backend are doubles, which matches the backend data type used by Atlas. This is acceptable, because the deltas are expected to be much smaller values.

Some of the newer thin clients, such as spectator-go, specify the uint64 data type for monotonic counters.

Note that the previous implementation for monotonic counters did not handle rollovers correctly, and this change fixes that behavior for both types.