Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension point for returning different content types from API endpoints: expose QueryData so that implementations of Codec can use it. #427

Merged

Conversation

charleskorn
Copy link
Contributor

@charleskorn charleskorn commented Feb 2, 2023

Continuation of #412 - ran into this issue while implementing the new protobuf codec in the querier.

…form a type assertion against Response.Data.

Signed-off-by: Charles Korn <charles.korn@grafana.com>
@pracucci
Copy link
Collaborator

pracucci commented Feb 2, 2023

Would be great to have these changes proposed in upstream Prometheus too. For example, exposing a struct like you did here should be non controversial.

@charleskorn
Copy link
Contributor Author

Would be great to have these changes proposed in upstream Prometheus too. For example, exposing a struct like you did here should be non controversial.

Yep, I've added it to prometheus/prometheus#11905.

@charleskorn charleskorn marked this pull request as ready for review February 3, 2023 01:49
@charleskorn
Copy link
Contributor Author

This is now ready for review.

@pracucci pracucci merged commit d2d23d9 into main Feb 3, 2023
@pracucci pracucci deleted the mimir-prometheus-api-response-format-extension-point branch February 3, 2023 04:38
charleskorn added a commit to grafana/mimir that referenced this pull request Feb 3, 2023
pracucci added a commit to grafana/mimir that referenced this pull request Feb 18, 2023
… requested + request format from query-frontend if enabled (#4153)

* Add initial implementation of protobuf codec in querier.

* Introduce flag to enable requesting new query result payload format from querier.

* Add integration test for new query result payload format.

* Extract JSON decoding to its own method.

* Fix typo.

* Rename test.

* Always check for expected error in test.

* Send appropriate Accept header based on configured query result payload format.

* Extract JSON format to its own type, and fail if a query response contains an unknown content type.

* Move JSON format tests to their own file.

* Add TODO.

* Implement protobuf format for decoding responses from querier in query-frontend.

* Add changelog entry.

* Use main branch of mimir-prometheus now that grafana/mimir-prometheus#427 has been merged.

* Address PR feedback: use t.Fatalf() in test.

* Address PR feedback: return pointer from DecodeResponse.

* Address PR feedback: use `query-result-response-format` as flag name.

Co-authored-by: Marco Pracucci <marco@pracucci.com>

* Address PR feedback: clarify test names.

Co-authored-by: Marco Pracucci <marco@pracucci.com>

* Address PR feedback: fix test names.

Co-authored-by: Marco Pracucci <marco@pracucci.com>

* Address PR feedback: avoid confusion by specifying protobuf format as preferred format in test.

* Address PR feedback: take preferred format as parameter rather than entire query middleware config.

* Rename configuration option everywhere.

* Address PR feedback: store preferred response format and use switch statement to set Accept header.

* Address PR feedback: rename format to formatter.

* Use new flag name in integration test.

* Update docs.

---------

Co-authored-by: Marco Pracucci <marco@pracucci.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants