Skip to content
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

Add the sum of all values that were added #12

Open
rochdev opened this issue Nov 3, 2019 · 0 comments
Open

Add the sum of all values that were added #12

rochdev opened this issue Nov 3, 2019 · 0 comments

Comments

@rochdev
Copy link

rochdev commented Nov 3, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant