[ADD] monitoring_prometheus_queue_job

This commit features a refactoring of monitoring_prometheus to get a
cron gathering some metrics from the database, and then publishing the
result on the /metrics endpoint

The new module monitoring_prometheus_queue_job extends the cron to get
information about the queue job states.
This commit is contained in:
Alexandre Fayolle authored and Maksym Yankin committed 2026-09-30 19:33:16 +03:00
1 parent 64dc2fc8fd
commit 8a660b6081
18 files changed
+274 -7

No files matched your search

+26
View File
@@ -15,3 +15,29 @@ Current available metrics are:
* Longpolling request count
No additional configuration is needed, just ensure that the Prometheus server is allowed to communicate with Odoo
Gathering metrics from the database
-----------------------------------
Metrics that require a database query are collected by the *Prometheus: gather metrics*
scheduled action, which runs every 15 minutes and stores its result as
``prometheus.metric`` records (one per metric name/labels combination). The */metrics*
endpoint reads those records and publishes them as gauges. This indirection is required
because the cron and the HTTP workers run in separate processes and cannot share the
Prometheus registry.
By default, only users in the *Administration / Settings* group (``base.group_system``)
can read ``prometheus.metric`` records through the ORM/UI. The */metrics* endpoint
remains public and reads the records with ``sudo()`` so Prometheus can keep scraping it
without authentication.
To publish new metrics, extend ``_gather_metrics`` on the ``prometheus.gatherer``
abstract model and return the result of ``super()`` extended with your own entries::
{
"name": "odoo_some_metric",
"documentation": "What this metric measures",
"labels": {"label_name": "label_value"},
"value": 42,
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.