api: add infos field to query API response for Prometheus compatibility#8748
Open
abhay1999 wants to merge 1 commit intothanos-io:mainfrom
Open
api: add infos field to query API response for Prometheus compatibility#8748abhay1999 wants to merge 1 commit intothanos-io:mainfrom
abhay1999 wants to merge 1 commit intothanos-io:mainfrom
Conversation
Prometheus added a separate `infos` field to the query API response in prometheus/prometheus#14327 to distinguish informational annotations (e.g. histogram monotonicity fixes) from actionable warnings. Thanos needs the same field to maintain Prometheus API compatibility. PromQL info annotations wrap `annotations.PromQLInfo` and are detected via a string prefix check (rather than errors.Is) because errors serialized over gRPC lose their type information. Signed-off-by: Abhay Chaurasiya <abhaychaurasiya19@gmail.com>
db8df7d to
cd82d28
Compare
Author
|
The Documentation check failure is unrelated to this PR. It's caused by 4 broken external links in pre-existing docs:
None of these files were modified in this PR. The same failure reproduces on |
Author
|
The Thanos end-to-end tests (8, 4) failure is also unrelated to this PR. It's a timeout in |
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.
What does this PR do?
Prometheus added a separate
infosfield to the query API response in prometheus/prometheus#14327 to distinguish informational PromQL annotations (like histogram monotonicity corrections) from actionable warnings. Without this field, Thanos returns all PromQL infos mixed intowarnings, which breaks clients that depend on Prometheus API compatibility.This PR adds the
infosfield to Thanos's query API response and separates PromQL info annotations from warnings at the response layer.Closes #7597
Changes
pkg/api/api.go: addedInfos []stringfield to theresponsestruct; updatedRespond()to route PromQL info annotations toinfosinstead ofwarningspkg/extannotations/annotations.go: addedIsPromQLInfo()helper (string-prefix based, matching the existingIsPromQLAnnotationapproach, since gRPC serialization strips error type info)pkg/api/api_test.go: addedTestRespondInfosAndWarningsto verify the routing logicExample response
{ "status": "success", "data": { ... }, "warnings": ["PromQL warning: mixed floats and histograms for ..."], "infos": ["PromQL info: input to histogram_quantile needed to be fixed for monotonicity ..."] }Checklist
TestQueryEndpointsfailure also reproduces onmainwithout this PR)Signed-off-by: Abhay Chaurasiya abhaychaurasiya19@gmail.com