Closed aster1sk closed 2 months ago
The recent update integrates Prometheus metrics into the system's realtime processing capabilities. This includes initializing and registering metrics, specifically a counter for BirdNET detections by common name, and setting up an HTTP endpoint for metrics exposure. Additionally, the processor's method for handling pending detections now updates these metrics based on specific conditions, and configuration settings have been adjusted to support these changes.
File Path | Change Summary |
---|---|
cmd/realtime/... , internal/analysis/realtime.go |
Added Prometheus metrics initialization, BirdNET detection counter, and metrics exposure via HTTP. |
internal/analysis/processor/processor.go |
Updated pendingDetectionsFlusher method to modify Prometheus detection counter. |
internal/conf/config.go |
Added support for Prometheus metrics in Realtime settings, including new configuration fields. |
🌟🐰✨ In the realm of code, where the rabbits hop,
Metrics spring up, never to stop.
Counting the birds, so high and so free,
With Prometheus's help, as easy as can be.
Hooray for changes, let's give a cheer,
For better insights are now here!
🌟🐰✨
cmd/realtime/realtime.go (1)
`40-40`: Added flag for enabling Prometheus metrics correctly.internal/conf/config.go (1)
`43-44`: Added configuration fields for Prometheus metrics correctly.internal/analysis/processor/processor.go (1)
`332-336`: Update to Prometheus detection counter implemented correctly.
Thank you, merged.
This is very nice! I would like to add some more metrics in the future for observability of the health of the application etc :+1:
Just one question, would it be better to offer the /metrics view at the same port used for serving the webpage itself at? In this case 8080. That would make the port forwarding a bit easier. However, I suppose one benefit of having it on a separate port is that it allows more control of who should have access to the metrics?
I have been thinking of adding Go telemetry for some time , so this is more than welcome. I'd prefer to keep telemetry endpoint separate from main application, for example if people wish to publish their dashboard to Internet it would be at least some level security issue if application telemetry would be exposed as well.
I understand there is interest in keeping birdnet-go as lightweight as possible so instead of building out a full-blown Web UI, perhaps an alternative option could be to export metrics to Prometheus and visualized with existing tools like Grafana.
This PR include a bool configuration option to enable a very basic Prometheus CounterVec as well as all of the boilerplate Go performance metrics.
To enable the Prometheus endpoint, simply include the following in your configuration file.
The current implementation is very simple, the following is sample output from development / testing :
This could easily be improved upon with :
Summary by CodeRabbit