-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store sum of events for different metrics #1181
Conversation
|
@vladimir-bukhtoyarov any suggestions for suitable sum storage type? |
I'm not sure I see the issue. You need to run with many cores on a very popular task to have this duration exceed 192 years. And even if this happens, would it cause a problem? When using monotonous increasing counters you will miss just a single measurement. |
Keep in mind that you are unable to achive even |
I argue that this kind of functionality is not needed at core level. The problem can be easy solved by decorators. Anyone who firstly wants to have sum, secondly understands the risks related to overflow, can easily decorate any timer or histogram and implement sum reporting as separated gauge. Of course it is possible to replace LongAdder by DoubleAdder to pospone the overflow, but accuracy of sum will be significantly decreased. |
OK, now it's clear. |
True, but can't we still say we miss one measurement on average per 192 year of duration data? |
This is a rework of PR #1022 by @hashbrowncipher (and fixes @slovdahl's issue #712). This PR is based on the 4.0-development branch, which has evolved further than master.
The main differences are:
Summing
interface, which is implemented byMeter
,Timer
andHistogram
Summing.sum()
is done as a long to avoid loss of precision on high values due to floating point propertiessum()
property of the relevant metricsThe main purpose of storing the sum is to facilitate monitoring systems that use raw ascending counters (e.g. Prometheus), and time-series databases such as InfluxDB (see also @mevdschee comment)