Skip to content

Add the sum of all values that were added #12

@rochdev

Description

@rochdev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions