Files
session_redis_public/monitoring_prometheus/README.rst
T
Alexandre Fayolle 33bfbfef57 [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.
2026-09-03 15:59:00 +02:00

39 lines
1.4 KiB
ReStructuredText

.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License
==============================
Monitoring: Prometheus metrics
==============================
Add an endpoint */metrics* to allow a Prometheus server to fetch application metrics.
Current available metrics are:
* Request completion time with 3 differentiators:
* Filestore
* Assets
* Everything else
* 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 JSON in the
``monitoring_prometheus.metrics`` system parameter. The */metrics* endpoint reads that
parameter and publishes the entries as gauges. This indirection is required because the
cron and the HTTP workers run in separate processes and cannot share the Prometheus
registry.
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,
}