diff --git a/argocd/manifests/grafana-config/dashboards/configmap-cv-apm.yaml b/argocd/manifests/grafana-config/dashboards/configmap-cv-apm.yaml index fef84d7..fd05c4f 100644 --- a/argocd/manifests/grafana-config/dashboards/configmap-cv-apm.yaml +++ b/argocd/manifests/grafana-config/dashboards/configmap-cv-apm.yaml @@ -90,6 +90,7 @@ data: "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, + "mappings": [{ "type": "special", "options": { "match": "null+nan", "result": { "text": "No traffic", "color": "text" } } }], "thresholds": { "mode": "absolute", "steps": [{ "color": "red", "value": null }, { "color": "yellow", "value": 0.5 }, { "color": "green", "value": 0.8 }] }, "unit": "percentunit" }, @@ -106,7 +107,7 @@ data: "textMode": "auto" }, "targets": [ - { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(flyio_nginx_cache_requests_total{host=\"cv.eblu.me\",cache_status=\"HIT\"}[5m])) / sum(rate(flyio_nginx_cache_requests_total{host=\"cv.eblu.me\"}[5m]))", "refId": "A" } + { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(increase(flyio_nginx_cache_requests_total{host=\"cv.eblu.me\",cache_status=\"HIT\"}[$__range])) / sum(increase(flyio_nginx_cache_requests_total{host=\"cv.eblu.me\"}[$__range]))", "refId": "A" } ], "title": "Cache Hit Ratio", "type": "stat" diff --git a/argocd/manifests/grafana-config/dashboards/configmap-docs-apm.yaml b/argocd/manifests/grafana-config/dashboards/configmap-docs-apm.yaml index 8a7c60c..b96d1ea 100644 --- a/argocd/manifests/grafana-config/dashboards/configmap-docs-apm.yaml +++ b/argocd/manifests/grafana-config/dashboards/configmap-docs-apm.yaml @@ -90,6 +90,7 @@ data: "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, + "mappings": [{ "type": "special", "options": { "match": "null+nan", "result": { "text": "No traffic", "color": "text" } } }], "thresholds": { "mode": "absolute", "steps": [{ "color": "red", "value": null }, { "color": "yellow", "value": 0.5 }, { "color": "green", "value": 0.8 }] }, "unit": "percentunit" }, @@ -106,7 +107,7 @@ data: "textMode": "auto" }, "targets": [ - { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(flyio_nginx_cache_requests_total{host=\"docs.eblu.me\",cache_status=\"HIT\"}[5m])) / sum(rate(flyio_nginx_cache_requests_total{host=\"docs.eblu.me\"}[5m]))", "refId": "A" } + { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(increase(flyio_nginx_cache_requests_total{host=\"docs.eblu.me\",cache_status=\"HIT\"}[$__range])) / sum(increase(flyio_nginx_cache_requests_total{host=\"docs.eblu.me\"}[$__range]))", "refId": "A" } ], "title": "Cache Hit Ratio", "type": "stat" diff --git a/argocd/manifests/grafana-config/dashboards/configmap-flyio.yaml b/argocd/manifests/grafana-config/dashboards/configmap-flyio.yaml index 7228060..981f7ea 100644 --- a/argocd/manifests/grafana-config/dashboards/configmap-flyio.yaml +++ b/argocd/manifests/grafana-config/dashboards/configmap-flyio.yaml @@ -101,6 +101,7 @@ data: "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, + "mappings": [{ "type": "special", "options": { "match": "null+nan", "result": { "text": "No traffic", "color": "text" } } }], "thresholds": { "mode": "absolute", "steps": [{ "color": "red", "value": null }, { "color": "yellow", "value": 0.5 }, { "color": "green", "value": 0.8 }] }, "unit": "percentunit" }, @@ -117,7 +118,7 @@ data: "textMode": "auto" }, "targets": [ - { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(flyio_nginx_cache_requests_total{instance=\"flyio-proxy\",cache_status=\"HIT\"}[5m])) / sum(rate(flyio_nginx_cache_requests_total{instance=\"flyio-proxy\"}[5m]))", "refId": "A" } + { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(increase(flyio_nginx_cache_requests_total{instance=\"flyio-proxy\",cache_status=\"HIT\"}[$__range])) / sum(increase(flyio_nginx_cache_requests_total{instance=\"flyio-proxy\"}[$__range]))", "refId": "A" } ], "title": "Cache Hit Ratio", "type": "stat" diff --git a/docs/changelog.d/fix-cache-hit-rate-dashboards.bugfix.md b/docs/changelog.d/fix-cache-hit-rate-dashboards.bugfix.md new file mode 100644 index 0000000..571a576 --- /dev/null +++ b/docs/changelog.d/fix-cache-hit-rate-dashboards.bugfix.md @@ -0,0 +1 @@ +Fix cache hit rate panels on APM and Fly.io dashboards showing blank/red or misleading 100% for low-traffic static sites. diff --git a/fly/alloy.river b/fly/alloy.river index 36417d4..06ad977 100644 --- a/fly/alloy.river +++ b/fly/alloy.river @@ -79,7 +79,6 @@ loki.process "nginx" { name = "flyio_nginx_cache_requests_total" description = "Total cache lookups by cache status." source = "cache_status" - match_all = true action = "inc" } }