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

Grafana needs to know scrape_interval for $__rate_interval #546

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

nobuto-m
Copy link
Contributor

@nobuto-m nobuto-m commented Nov 1, 2023

Issue

Closes: #543

Solution

Grafana assumes the scrape interval as 15s by default but COS stack assumes 1m. Without telling Grafana that COS Prometheus uses 1m as the global scrape interval, many graphs will break since $__rate_interval won't be calculated properly.

Context

Hardcoding 1m itself is in question, but this patch fixes many graphs using $__rate_interval without touching the fundamental pieces.

ref:
https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/#interval-behavior https://grafana.com/blog/2020/09/28/new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work/ #544

Testing Instructions

Deploy the COS stack and grafana-agent machine charm and relate those. Open the node-exporter dashboard in Grafana and zoom into 15 min and confirm the graphs are shown instead of "no data".

Also, double check the scrape interval is set as 1m in the data source configuration.

image

Release Notes

Grafana assumes the scrape interval as 15s by default but COS stack
assumes 1m. Without telling Grafana that COS Prometheus uses 1m as the
global scrape interval, many graphs will break since $__rate_interval
won't be calculated properly.

Hardcoding 1m itself is in question, but this patch fixes many graphs
using $__rate_interval without touching the fundamental pieces.

ref:
https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/#interval-behavior
https://grafana.com/blog/2020/09/28/new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work/
canonical#544

Closes: canonical#543
@nobuto-m nobuto-m force-pushed the scrape-interval-for-grafana branch from e6f0803 to f300e64 Compare November 2, 2023 13:10
@dstathis dstathis merged commit b4d67ad into canonical:main Nov 6, 2023
12 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.

Inconsistent scrape interval in Prometheus and Grafana breaks graphs with $__rate_interval
2 participants