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 cortex_frontend_query_result_cache_requests_total and cortex_frontend_query_result_cache_hits_total metrics #5235

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

pracucci
Copy link
Collaborator

What this PR does

In #5212 I've added the optional and experimental support to lookup cardinality queries from the cache. However, we don't have a way to track the cache hit ratio specifically for the cardinality API endpoints. Reason is that today we measure the query-frontend cache hit ratio looking at the underlying memcache metrics (e.g. thanos_cache_memcached_hits_total / thanos_cache_memcached_requests_total) which are not split by request type / route (and not easy to do).

In this PR I propose to add a couple of new metrics which specifically track the query results cache cache hit ratio. I haven't changed the "Mimir / Queries" dashboard yet because I would like to see the new metrics deployed first before changing the dashboard (changes will be backward compatible).

Note to reviewers:

  • The new metrics have been prefixed by cortex_frontend_query_result_cache_  to keep it consistent with other metrics we already have
  • At this level we don't have route and propagating it would be quite tedious. On the other hand, I would prefer to not add logic to detect the route from the request URL, so I went to a simpler path which is a simple hardcoded request_type whose values could be query_range or cardinality.

Which issue(s) this PR fixes or relates to

N/A

Checklist

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

…tend_query_result_cache_hits_total metrics

Signed-off-by: Marco Pracucci <marco@pracucci.com>
@pracucci pracucci requested a review from pstibrany June 12, 2023 16:10
@pracucci pracucci marked this pull request as ready for review June 13, 2023 07:04
@pracucci pracucci requested a review from a team as a code owner June 13, 2023 07:04
Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Looks fine.

@pracucci pracucci merged commit ce6dd45 into main Jun 14, 2023
@pracucci pracucci deleted the add-query-results-cache-metrics branch June 14, 2023 07:34
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.

2 participants