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

frontend: allow injecting custom middlewares #8342

Merged
merged 3 commits into from
Jun 14, 2024

Conversation

ortuman
Copy link
Contributor

@ortuman ortuman commented Jun 11, 2024

What this PR does

This PR adds an additional field named ExtraMiddlewares to middleware config type that allows an upstream project to inject custom middlewares into the middleware harness without interfering with the main functionality of the frontend component.

UPDATE: After thoroughly inspecting the implementation of MetricsQueryRequest, I've observed that during the decoding process the original headers of the HTTP request are discarded. However, these headers can be of particular interest to external middlewares. Therefore, I've decided to add an extra method, GetHeaders to the interface and rename the proto type from PrometheusResponseHeader to simply PrometheusHeader.

Which issue(s) this PR fixes or relates to

Fixes N/A

@ortuman ortuman requested a review from a team as a code owner June 11, 2024 13:56
@ortuman ortuman marked this pull request as draft June 11, 2024 14:21
ortuman added 2 commits June 14, 2024 14:10
Signed-off-by: Miguel Ángel Ortuño <ortuman@gmail.com>
Signed-off-by: Miguel Ángel Ortuño <ortuman@gmail.com>
@ortuman ortuman force-pushed the ortuman/frontend/allow-mapping-middleware branch from bbe2049 to 023f43f Compare June 14, 2024 12:10
Signed-off-by: Miguel Ángel Ortuño <ortuman@gmail.com>
@ortuman ortuman force-pushed the ortuman/frontend/allow-mapping-middleware branch from 023f43f to 25dc80c Compare June 14, 2024 12:14
@ortuman ortuman marked this pull request as ready for review June 14, 2024 12:32
@colega colega self-requested a review June 14, 2024 13:11
@ortuman ortuman merged commit 4d109f5 into main Jun 14, 2024
29 checks passed
@ortuman ortuman deleted the ortuman/frontend/allow-mapping-middleware branch June 14, 2024 13:14
krajorama added a commit that referenced this pull request Jun 17, 2024
Make it more explicit that injection is only applied to instance
and range queries.

Follows #8342
Related to https://github.com/grafana/mimir-squad/issues/2148

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
krajorama added a commit that referenced this pull request Jun 17, 2024
Make it more explicit that injection is only applied to instance
and range queries.

Follows #8342
Related to https://github.com/grafana/mimir-squad/issues/2148

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
krajorama added a commit that referenced this pull request Jun 17, 2024
Make it more explicit that injection is only applied to instance
and range queries.

Follows #8342
Related to https://github.com/grafana/mimir-squad/issues/2148

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants