Conversation
choose_encoder compared the version parameter of the Accept header as a tuple of mixed ints and strings, so a version such as 1.0.0-rc.1, a quoted "1.0.0" or latest raised TypeError and the scrape answered 500. Treat such a version as unsupported, which falls through to the next media range and finally to text/plain version 0.0.4. Signed-off-by: Christopher Krah <github@christopher-krah.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.
choose_encodercompares the Acceptversionwithparse_version(version) >= (1, 0, 0)(prometheus_client/exposition.py:375and:384). With1.0.0-rc.1, a quoted"1.0.0"orlatest, that comparison raisesTypeErrorand the scrape answers 500. This pull request treats a version with a non-numeric part as unsupported, so it falls through to the next media range and ends attext/plain; version=0.0.4, asversion=1.0already does.Before, at
9cd073c:Before #1136,
packaging.VersionraisedInvalidVersionhere forlatest. Since #1136, a pre-release such as1.0.0-rc.1fails too.Verification
No issue exists for this.
@csmarchbanks, should a quoted
version="1.0.0"be unquoted and served as OpenMetrics 1.0.0? I can add that to this pull request.