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

Switch from mean to sum for histograms to simplify calculations #3

Closed
wants to merge 1 commit into from

Conversation

kgeckhart
Copy link
Owner

The current logic for merging a histogram has some incorrect math for how the mean is merged. The end result of this is that the sum can go up and down causing all sorts of problems with histogram calculations,
image

At the end of the day we don't really care about the mean value the histogram only wants the sum. Instead of trying to properly merge two mean values this PR switches to calculating the sum for the histogram and increasing that value as new data arrives. This should ensure an ever increasing sum as prometheus expects unless GCP produces a distribution with a negative mean which should hopefully never happen.

@kgeckhart kgeckhart closed this Feb 27, 2024
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

Successfully merging this pull request may close these issues.

1 participant