HdrHistogram / HdrHistogram/HdrHistogramJS

Add the sum of all values that were added

Open
#12 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
130
Forks
18
PR merge metrics
No merged PRs in 30d

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the histogram API and the backlog discussion about BigInt support. Define how the sum is exposed, reset, and stored without losing correctness for large values; done should include tests covering normal values, reset behavior, and large-number handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.