Repository navigation
frigate_camera_events is typed as a counter but decreases as events are pruned — gauge or proper counter? #23635
Replies: 2 comments
|
The documentation confirms that Your analysis is correct — if the implementation queries the database with I don't have information in the available sources about which direction the maintainers would prefer for a fix. This would be a good question to raise directly with the maintainers. You can reach out via GitHub to discuss whether they prefer:
Would you like me to try to provide a general answer about the tradeoffs between these approaches? 📚 Sources: Have another question? Just tag @inkeep. |
|
The Prometheus metrics are effectively community maintained, so I'm not sure what the direction of the original implementation was intended but what you describe does not sound correct behavior |
Uh oh!
There was an error while loading. Please reload this page.
Hi, I think there's a discrepancy between the documentation and the actual behavior of the
frigate_camera_eventsPrometheus metric, and I'd like to check the intended direction before opening a PR.frigate_camera_eventsis declared as a counter, but in practice it behaves like a gauge — it decreases when events are pruned from the database. Because it's typed as a counter, Prometheus treats each drop as a counter reset, soincrease()/rate()massively over-count. In my setup ~26 events/day showed up as several thousand.Root cause: the /api/metrics handler runs
SELECT camera, label, COUNT(*) ... GROUP BY camera, labelon the events table (a live snapshot that shrinks on pruning), andfrigate/stats/prometheus.pyexposes it viaCounterMetricFamily. The value is really a gauge but is typed as a counter.How to reproduce:
I see two ways to fix it:
Which direction would you prefer? If a gauge is acceptable, I already have it implemented and can open a PR right away.
Version: 0.17.1 (same code on dev)
All reactions