-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Most histograms I've seen are able to return the sum of all added values since the last reset. This is even mentioned in the Prometheus docs. While this could be done in a wrapper over this library, having it built-in would be a nice addition (no pun intended).
Given that the maximum integer in JavaScript is very low, this cannot really be correctly implemented for large numbers using Number. However, I've seen in the backlog that BigInt support is planned, so maybe that would be an option to store the sum? Right now BigInt is not really optimized and is pretty slow, but computing the sum could always be an option disabled by default that can be enabled when needed. It may also be possible to use a Number up to a point where it would overflow and then switch to a BigInt.