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

[query-frontend] Set http request headers from querymiddleware request options #7033

Merged
merged 4 commits into from
Jan 4, 2024

Conversation

flxbk
Copy link
Contributor

@flxbk flxbk commented Jan 3, 2024

What this PR does

prometheusCodec provides the methods DecodeRequest and EncodeRequest to convert from an http.Request to a querymiddleware.Request and back. The conversion from an http request sets values in the request options, but these are not considered for the conversion back to an http request. As a consequence, the http request obtained by decoding and re-encoding is not equivalent to the original request in cases where custom headers were present on the initial request.

This PR adds http headers equivalent to the request options to fix this.

Which issue(s) this PR fixes or relates to

Fixes n/a

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@flxbk flxbk marked this pull request as ready for review January 3, 2024 09:56
@flxbk flxbk requested a review from a team as a code owner January 3, 2024 09:56
Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're missing a header. I'm curious how you discovered this and the reason for this chage. Has it caused any bugs?

pkg/frontend/querymiddleware/codec.go Outdated Show resolved Hide resolved
pkg/frontend/querymiddleware/codec.go Show resolved Hide resolved
Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you

@flxbk flxbk merged commit fb7f57b into main Jan 4, 2024
28 checks passed
@flxbk flxbk deleted the felix/fix-encode-request branch January 4, 2024 08:57
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.

None yet

3 participants