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

Added endpoint to see caching metrics from grafana/prometheus #1678

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AbrarQuazi
Copy link
Contributor

This PR exposes an endpoint to see cache metrics such as cache hits, misses and latency information which prometheus can scrape for grafana dashboarding

use lazy_static::lazy_static;
use prometheus::{register_counter, register_histogram, Counter, Histogram};

lazy_static! {
Copy link
Contributor Author

@AbrarQuazi AbrarQuazi Feb 26, 2025

Choose a reason for hiding this comment

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

prometheus should be able to hit the /metrics endpoint and scrape data for the following pomql queries to show in grafana dashboards:

// query for average hits per second over specified times
rate(cache_hits[5m]) #or alternatively total hits over specified time: increase(cache_hits[5m])

// query for average misses per second over specified times
rate(cache_misses[5m])

// query for hit ratio over specified time
sum(increase(cache_hits[5m])) / sum(increase(cache_hits[5m]) + increase(cache_misses[5m]))

// query for rolling average latency
rate(hit_latency_ms_sum[5m]) / rate(hit_latency_ms_count[5m])
rate(miss_latency_ms_sum[5m]) / rate(miss_latency_ms_count[5m])

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.

1 participant