Skip to content

Commit b321706

Browse files
committed
fix dashboard rate interval
1 parent 7c6a03c commit b321706

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

deployment/pcm/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,14 @@ promtool query instant http://127.0.0.1:8001/api/v1/namespaces/default/services/
249249
250250
# 1) Download dashboard
251251
curl -Ls http://127.0.0.1:8001/api/v1/namespaces/default/pods/$podname/proxy/dashboard/prometheus -o pcm-dashboard.json
252-
sed -i 's/4s/2m/' pcm-dashboard.json
252+
253+
# change default (too small) interval (from 4s to 2m, following Prometheus best practicies of rate being four times larger than scrapping 30s)
254+
# References:
255+
# https://grafana.com/blog/2020/09/28/new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work/
256+
# ($__rate_interval is 4 x scrape interval defined in datasource provisioned by prometheus operator, scrape internval is based on Prometheus object which defaults to 30s)
257+
# - https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/values.yaml#L1069
258+
# - https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/values.yaml#L3381
259+
sed -i 's/4s/$__rate_interval/g' pcm-dashboard.json
253260
254261
# 2) port forward with kubectl (--address=0.0.0.0)
255262
kubectl port-forward -n default service/prometheus-grafana 8002:80
@@ -258,9 +265,9 @@ kubectl port-forward -n default service/prometheus-grafana 8002:80
258265
# or get password kubectl get secret --namespace default prometheus-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
259266
http://127.0.0.1:8002
260267
261-
# 4) Go to Dashboards/New/Import
268+
# 4) Go to Dashboards/New/Import and upload:
269+
262270
pcm-dashboard.json
263-
# and open
264271
265272
```
266273

0 commit comments

Comments
 (0)