Conversation
_prepare_buckets accepted any non-decreasing list, so buckets=[0.1, 0.5, 0.5, 1.0] exposed two series with le="0.5" and a NaN bound passed too. Require strictly increasing bounds, as client_golang does. Signed-off-by: Christopher Krah <[email protected]>
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.
A
NaNbucket bound passesHistogram._prepare_buckets(prometheus_client/metrics.py:642), becausebuckets != sorted(buckets)never fires on it. The histogram then exposes anle="NaN"series that no observation can land in. This change requires strictly increasing bounds:[0.1, nan, 1.0]and a repeated bound such as[0.1, 0.5, 0.5, 1.0]now raiseValueErrorat construction. No issue exists for this.Before, at
9cd073c:The repeated bound is the part to decide. Prometheus ingests it today, since both
le="0.5"series always carry the same value. Raising there buys consistency withclient_golang("histogram buckets must be in increasing order",prometheus/histogram.go:590), not ingestion safety. Code that passes one today gets aValueErrorwith this change. A lone[nan]still passes, as the check compares pairs.Verification
This touches the same function as #1104. I will rebase onto whichever lands first.
@csmarchbanks, should a repeated bound raise as here, or be dropped silently as
client_javadoes?