canonical / prometheus-k8s-operator

https://charmhub.io/prometheus-k8s
Apache License 2.0
21 stars 34 forks source link

Grafana needs to know scrape_interval for $__rate_interval #546

Closed nobuto-m closed 12 months ago

nobuto-m commented 1 year ago

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/ https://github.com/canonical/prometheus-k8s-operator/issues/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