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

Return server-side total bytes processed statistics as a header through query frontend #9645

Conversation

madhu-reddy-peram
Copy link
Contributor

@madhu-reddy-peram madhu-reddy-peram commented Oct 16, 2024

What this PR does

This pull request adds bytes-processed statistics to the existing Server-Timing HTTP header in the query frontend. It provides information about the total bytes processed by Mimir for a query request that passes through the query frontend. This information will be useful for assessing user behaviour and applying rate limiting when users run expensive, long-range Mimir queries. It will help mitigate slow performance or occasional downtime in Mimir.

Which issue(s) this PR fixes or relates to

None

Checklist

  • Tests updated.
  • CHANGELOG.md updated

@madhu-reddy-peram madhu-reddy-peram requested a review from a team as a code owner October 16, 2024 14:12
@CLAassistant
Copy link

CLAassistant commented Oct 16, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! Instead of adding another header for the query-frontend to send, please add this new value to the existing Server-Timing header with the key bytes_processed.

@madhu-reddy-peram
Copy link
Contributor Author

Thanks for this PR! Instead of adding another header for the query-frontend to send, please add this new value to the existing Server-Timing header with the key bytes_processed.

@56quarters - Thank you for your feedback!
I chose to implement a new header for the X-Total-Bytes-Processed because the existing Server-Timing header primarily conveys timing information, and its keys are focused on duration. By introducing a dedicated header for bytes processed, clients can more easily access and handle this specific metric without needing to parse the Server-Timing header. I believe this approach enhances clarity and improves the overall user experience. However, I'm open to consolidating it into the existing header if you believe that would be more beneficial. Please confirm.

@56quarters
Copy link
Contributor

Thanks for this PR! Instead of adding another header for the query-frontend to send, please add this new value to the existing Server-Timing header with the key bytes_processed.

@56quarters - Thank you for your feedback! I chose to implement a new header for the X-Total-Bytes-Processed because the existing Server-Timing header primarily conveys timing information, and its keys are focused on duration. By introducing a dedicated header for bytes processed, clients can more easily access and handle this specific metric without needing to parse the Server-Timing header. I believe this approach enhances clarity and improves the overall user experience. However, I'm open to consolidating it into the existing header if you believe that would be more beneficial. Please confirm.

I understand that parsing is simpler with a dedicated header but my preference is to minimize proliferation of custom headers that Mimir uses. I'd rather use the existing Server-Timing header. Thanks!

@madhu-reddy-peram
Copy link
Contributor Author

Thanks for this PR! Instead of adding another header for the query-frontend to send, please add this new value to the existing Server-Timing header with the key bytes_processed.

@56quarters - Thank you for your feedback! I chose to implement a new header for the X-Total-Bytes-Processed because the existing Server-Timing header primarily conveys timing information, and its keys are focused on duration. By introducing a dedicated header for bytes processed, clients can more easily access and handle this specific metric without needing to parse the Server-Timing header. I believe this approach enhances clarity and improves the overall user experience. However, I'm open to consolidating it into the existing header if you believe that would be more beneficial. Please confirm.

I understand that parsing is simpler with a dedicated header but my preference is to minimize proliferation of custom headers that Mimir uses. I'd rather use the existing Server-Timing header. Thanks!

@56quarters - Thank you for the clarification! I’ve updated the PR to add the bytes processed stats into the existing Server-Timing header as requested. Let me know if there’s anything else you’d like me to address.

Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

@56quarters
Copy link
Contributor

Looks like there are a few integration tests that need to be updated to work with the new key.

@madhu-reddy-peram
Copy link
Contributor Author

Looks like there are a few integration tests that need to be updated to work with the new key.

Looking into these now.

@madhu-reddy-peram
Copy link
Contributor Author

Looks like there are a few integration tests that need to be updated to work with the new key.

Looking into these now.

I've pushed a commit that should fix the failing tests.

@56quarters 56quarters merged commit 2981566 into grafana:main Oct 16, 2024
29 checks passed
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.

3 participants