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

Add caching to QueryRange requests #3796

Merged
merged 3 commits into from
Jun 21, 2024
Merged

Conversation

mapno
Copy link
Member

@mapno mapno commented Jun 20, 2024

What this PR does:

Adds caching to query range requests

Checklist

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

@mapno mapno marked this pull request as ready for review June 20, 2024 16:16
@@ -393,6 +396,10 @@ func (s *queryRangeSharder) buildBackendRequests(ctx context.Context, tenantID s

prepareRequestForQueriers(subR, tenantID, subR.URL.Path, subR.URL.Query())
// TODO: Handle sampling rate
key := queryRangeCacheKey(tenantID, queryHash, int64(queryRangeReq.Start), int64(queryRangeReq.End), m, int(queryRangeReq.StartPage), int(queryRangeReq.PagesToSearch))
Copy link
Member

Choose a reason for hiding this comment

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

seeing a lot of other fields in the QueryRangeRequest struct. Should Step be in the cache key? ShardID/Count?

Copy link
Member Author

@mapno mapno Jun 21, 2024

Choose a reason for hiding this comment

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

Step is part of the hash. ShardID and ShardCount are used in non-RF1 queries which have a different path.

@mapno mapno merged commit 480e967 into grafana:main Jun 21, 2024
14 checks passed
@mapno mapno deleted the metrics-frontend-caching branch June 21, 2024 13:11
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