상황
- Grafana 대시보드에서 Prometheus를 datasource로 사용하는 대시보드에서 metric들을 쿼리할 때, 그래프에 일부 값들이 표현되지 않았다.
- 비교적 짧은 기간(5 ~ 10m) 을 쿼리할 때에만 해당 증상이 나타났다. 긴 기간을 쿼리할 때에는 정상 작동했다.
추측했던 원인
- prometheus 의 버전 문제:
[$__rate_interval]
을 지원하지 않는 버전이지 않을까 추측함 -> 아니었다.
원인
- Prometheus 의
scrape_interval
값이 grafana의rate_interval
(조회 기간에 따라 자동 생성됨)값에 비해 크다. - Grafana 에서
rate_interval % 4
가 Prometheus 의scrape_interval
값 보다 작을 경우, 쿼리에 대한 결과값이 없다.
해결방법
- Prometheus의 scrape_config 값을 작게 조정했다.
prometheus:
enabled: true
server:
global:
scrape_interval: 15s # default: 1m
외부 링크(Grafana 공식 블로그)
아래 글에서 위 증상을 확인할 수 있다.
https://grafana.com/blog/2020/09/28/new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work/
New in Grafana 7.2: $__rate_interval for Prometheus rate queries that just work | Grafana Labs
Ronald McCollam · 30 Oct 2024 · 12 min read Grafana variables: what they are and how they create dynamic dashboards
grafana.com
'TIL > Monitoring(k8s, grafana)' 카테고리의 다른 글
[K8s, Grafana] Loki 데이터량 확인 및 유지기간 설정 방법 확인(2.6.1) (0) | 2024.12.10 |
---|---|
[RKE2] Too many open files 로 발생하는 crashLoopBackOff 에러 해결 (0) | 2024.12.01 |
[모니터링, Loki, 로그] Promtail 활용한 syslog 수집 (0) | 2024.11.26 |
[Prometheus] 적절한 scrape_interval을 찾아.. - Node exporter 코드 분석 (3) | 2024.11.06 |
워터컷 기록 및 정보 모음 (0) | 2024.10.31 |