mirror of
https://github.com/suitenumerique/messages.git
synced 2026-08-22 07:32:23 +02:00
* ✨(backend) add base django-prometheus metrics * ✨(backend) add prometheus metrics, add the message by status metric * ✨(backend) Add more metrics on attachement + add 0 by default for statuses * 🚨(backend) ignore import-outside-toplevel for collector * 🚨(backend) add all docstring + don't access private properties * 🔒️(backend) add basic auth to /metrics route * 🚸(backend) use labels instead of hard-coding statuses in metric * 📝(backend) document prometheus * 🎨(backend) lint * ✅(backend) add first tests for prometheus * 🚚(backend) move prometheus endpoint to api/<ver>/prometheus/metrics, change middlewarename * ✅(backend) add attachment tests for prometheus metrics * 🐛(backend) actually allow disabling prometheus * 🎨(backend) improve logic in mw * 🎨(backend) small review fixes * 🚨(backend) lint * 🐛(backend) Remove sha256 from factory * 🎨(backend) nitpicks + linter fixes * 🐛(poetry) remove duplicate prometheus package in dev deps * 🐛(poetry) add missing dep * 🐛(prom) make tests more reliable, disable by default + misc fixes * 📝(prom) fix docstring in tests --------- Co-authored-by: Stanislas Bruhiere <stanislas@bruhiere.fr>
50 lines
1.1 KiB
Markdown
50 lines
1.1 KiB
Markdown
# Exported Prometheus Metrics
|
|
|
|
This service exposes the following custom Prometheus metrics via the `api/v1.0/prometheus/metrics` endpoint, in addition to all metrics exported via [django-prometheus](https://github.com/django-commons/django-prometheus).
|
|
|
|
Custom metrics are collected from the database using Django ORM and are available when the application is running.
|
|
|
|
## Metrics
|
|
|
|
### Message Status Counts
|
|
|
|
This metric is exported with labels corresponding to each possible message delivery status.
|
|
|
|
**Metric:**
|
|
```
|
|
message_status_count{status="<status>"}
|
|
```
|
|
|
|
**Example:**
|
|
- `message_status_count{status="retry"}`
|
|
- `message_status_count{status="sent"}`
|
|
|
|
**Description:**
|
|
Number of messages with the given delivery status. If no messages exist for a status, the value is `0`.
|
|
|
|
---
|
|
|
|
### Attachment Count
|
|
|
|
**Metric:**
|
|
```
|
|
attachment_count
|
|
```
|
|
|
|
**Description:**
|
|
Total number of attachments in the database.
|
|
|
|
---
|
|
|
|
### Attachments Total Size
|
|
|
|
**Metric:**
|
|
```
|
|
attachments_total_size_bytes
|
|
```
|
|
|
|
**Description:**
|
|
Total size (in bytes) of all attachments, summed over the `blob.size` field.
|
|
|
|
|