Skip to content

Commit f32c71b

Browse files
author
GitHub Copilot
committed
Debug cache metrics
1 parent 71b33ce commit f32c71b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

etc/grafana/provisioning/dashboards/fingr-dashboard.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@
391391
"type": "prometheus",
392392
"uid": "prometheus"
393393
},
394-
"expr": "sum by(status) (rate(fingr_weather_data_freshness_total[5m]))",
394+
"expr": "sum by(status) (rate(fingr_weather_data_freshness_total[5m])) / sum(rate(fingr_weather_data_freshness_total[5m])) * 100",
395395
"legendFormat": "{{status}}",
396396
"refId": "A"
397397
}

fingr/weather.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ def fetch_weather(
3434
api_requests_total.labels(status="success").inc()
3535

3636
# Track weather data freshness
37-
if updated:
37+
logger.debug("Weather data status", status=updated)
38+
if updated == "Data-Modified":
3839
weather_data_freshness.labels(status="updated").inc()
39-
else:
40+
elif updated in ("Data-Not-Expired", "Data-Not-Modified"):
4041
weather_data_freshness.labels(status="cached").inc()
4142

4243
return forecast, updated

0 commit comments

Comments
 (0)