Repository navigation
Reject NaN increments on Counter - #1256
Open
WatchTree-19 wants to merge 1 commit into
Open
WatchTree-19 wants to merge 1 commit into
WatchTree-19 wants to merge 1 commit into
Conversation
Counter.inc rejected negative amounts but accepted NaN, which left the counter's total at NaN from then on. OpenMetrics requires a counter's total to be non-NaN and monotonically non-decreasing, so a NaN increment now raises ValueError and the total is left unchanged. Signed-off-by: WatchTree-19 <119982314+WatchTree-19@users.noreply.github.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.
Counter.increjects negative amounts but acceptsfloat('nan'), sincenan < 0is false. After one NaN increment the counter's total is NaN for the rest of the process:OpenMetrics says a Counter's Total "is a non-NaN and MUST be monotonically non-decreasing over time". This raises
ValueErrorfor a NaN amount, the same way a negative amount is handled, and leaves the total unchanged. Histogram NaN handling (#1225) is untouched.test_nan_increment_raisescovers it and fails on master.tests/passes apart from the modules needing optional extras I did not install (aiohttp, asgi, django, twisted), and flake8 is clean on both files.