Repository navigation
Conversation
Histogram leaves out _sum when its lowest bucket is negative, since OpenMetrics 1.0 doesn't allow a sum there. MultiProcessCollector builds its own histogram samples and kept the _sum from the mmap files, so the same histogram exposed an extra series in multiprocess mode. Drop _sum on the accumulate path when the lowest bucket bound is negative. merge(accumulate=False) still returns the raw value. Signed-off-by: Haegan McGarry <haeganm@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Histogramleaves out_sumwhen its lowest bucket is negative. that's been the case since #496, it's what OpenMetrics 1.0 says ("Negative threshold buckets MAY be used, but then the Histogram MetricPoint MUST NOT contain a sum value"), and it was confirmed as intended in #552 and #782.MultiProcessCollectorbuilds histogram samples on its own and never checks for this, so in multiprocess mode the same histogram still has a_sum:single process gives the same lines without
temp_delta_sum.this drops
_sumon the accumulate path when the lowest bucket is negative, so both modes match.merge(files, accumulate=False)still returns the raw value, since that's for writing merged values back to files. I also added a line to the histogram docs, since they list_sumas always there.heads up, this means multiprocess users with negative buckets lose
_sum. and OpenMetrics 2.0 goes the other way (every histogram MUST have count and sum, and negative thresholds are allowed). if you'd rather keep_sumand change single process instead, happy to flip it.test_histogram_negative_bucketsfails on master (AssertionError: 1.5 is not None) and passes here. full suite passes on 3.10 (Linux) and 3.12 (Windows), and flake8, isort and mypy are clean.@csmarchbanks