Skip to content

Add support for /api/v1/format_query API #6893

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

siddarth2810
Copy link
Contributor

@siddarth2810 siddarth2810 commented Jul 19, 2025

What this PR does:
The PR enables /api/v1/format_query API endpoint for formatting queries on Query Frontend and Querier

Which issue(s) this PR fixes:
Fixes #6670

Checklist

  • [NA] Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Siddarth Gundu <[email protected]>
@SungJin1212
Copy link
Member

SungJin1212 commented Jul 20, 2025

Thanks for the contribution. Do we have to require the auth?

@siddarth2810
Copy link
Contributor Author

Thanks for the contribution. Do we have to require the auth?

I ran a simple curl command and it only worked when I added the Auth Header and in documentation I noticed most the API endpoints for query frontend needed authentication so I concluded that, this endpoint too must need authentication.

screenshot-20250720-181938Z-selected

Let me know if I should be doing some additional checks, would really appreciate it. Thank you so much

@SungJin1212
Copy link
Member

This API is for PromQL pretty-formatting, I'm just wondering if the authentication is necessary for it.
@friedrich-at-adobe can you take a look?

@siddarth2810
Copy link
Contributor Author

This API is for PromQL pretty-formatting, I'm just wondering if the authentication is necessary for it. @friedrich-at-adobe can you take a look?

I see, I went through some documentation and based on Prometheus security what I understand is that a standalone prometheus server dosent need any auth because its presumed that untrusted users have access to the Prometheus HTTP endpoint

but when cortex acts as a prometheus web server it would still look for tenant ID on each request, as mentioned in Cortex Auth, so in the end we need auth ?

Apologies for any confusion I caused

Copy link
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

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

@siddarth2810 This looks good, but needs an integration test. Can you add it?

@friedrichg
Copy link
Member

friedrichg commented Jul 21, 2025

Thanks for the contribution. Do we have to require the auth?

I believe auth is handled already. The integration test will prove it.

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.

Support /api/v1/format_query API
3 participants