{ "uid": "enervision-api", "title": "EnerVision · API", "description": "Débit, erreurs et latences vus par l'API elle-même (prometheus-fastapi-instrumentator).", "tags": [ "enervision" ], "timezone": "browser", "editable": false, "graphTooltip": 1, "refresh": "10s", "schemaVersion": 39, "version": 1, "time": { "from": "now-1h", "to": "now" }, "templating": { "list": [] }, "annotations": { "list": [] }, "links": [], "panels": [ { "id": 1, "type": "stat", "title": "API", "gridPos": { "x": 0, "y": 0, "w": 6, "h": 4 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "up{job=\"backend\"}", "legendFormat": "", "range": true } ], "fieldConfig": { "defaults": { "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "green", "value": 1 } ] }, "color": { "mode": "thresholds" }, "mappings": [ { "type": "value", "options": { "0": { "text": "Injoignable", "color": "red" }, "1": { "text": "Joignable", "color": "green" } } } ] }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "area", "textMode": "auto" }, "description": "Prometheus joint-il /metrics ?" }, { "id": 2, "type": "stat", "title": "Débit", "gridPos": { "x": 6, "y": 0, "w": 6, "h": 4 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(http_requests_total{job=\"backend\"}[5m]))", "legendFormat": "", "range": true } ], "fieldConfig": { "defaults": { "unit": "reqps", "thresholds": { "mode": "absolute", "steps": [ { "color": "blue", "value": null } ] }, "color": { "mode": "thresholds" } }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "area", "textMode": "auto" } }, { "id": 3, "type": "stat", "title": "Erreurs 5xx", "gridPos": { "x": 12, "y": 0, "w": 6, "h": 4 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(http_requests_total{job=\"backend\", status=\"5xx\"}[5m])) / sum(rate(http_requests_total{job=\"backend\"}[5m]))", "legendFormat": "", "range": true } ], "fieldConfig": { "defaults": { "unit": "percentunit", "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "orange", "value": 0.01 }, { "color": "red", "value": 0.05 } ] }, "color": { "mode": "thresholds" } }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "area", "textMode": "auto" }, "description": "Seuil d'alerte : 5 % pendant 5 minutes." }, { "id": 4, "type": "stat", "title": "Latence p95", "gridPos": { "x": 18, "y": 0, "w": 6, "h": 4 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le) (rate(http_request_duration_highr_seconds_bucket{job=\"backend\"}[5m])))", "legendFormat": "", "range": true } ], "fieldConfig": { "defaults": { "unit": "s", "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "orange", "value": 0.5 }, { "color": "red", "value": 1 } ] }, "color": { "mode": "thresholds" } }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "area", "textMode": "auto" }, "description": "Seuil de charge : 500 ms (ADR 0015). Alerte au-delà d'une seconde pendant 10 minutes." }, { "id": 5, "type": "timeseries", "title": "Débit par route", "gridPos": { "x": 0, "y": 4, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (handler) (rate(http_requests_total{job=\"backend\"}[1m]))", "legendFormat": "{{handler}}", "range": true } ], "fieldConfig": { "defaults": { "unit": "reqps" }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "id": 6, "type": "timeseries", "title": "Latence de l'API", "gridPos": { "x": 12, "y": 4, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.50, sum by (le) (rate(http_request_duration_highr_seconds_bucket{job=\"backend\"}[1m])))", "legendFormat": "p50", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le) (rate(http_request_duration_highr_seconds_bucket{job=\"backend\"}[1m])))", "legendFormat": "p95", "range": true }, { "refId": "C", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.99, sum by (le) (rate(http_request_duration_highr_seconds_bucket{job=\"backend\"}[1m])))", "legendFormat": "p99", "range": true } ], "fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "id": 7, "type": "timeseries", "title": "Latence p95 par route", "gridPos": { "x": 0, "y": 12, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le, handler) (rate(http_request_duration_seconds_bucket{job=\"backend\"}[5m])))", "legendFormat": "{{handler}}", "range": true } ], "fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "description": "Estimée sur les seaux 50 ms à 2,5 s de http_request_duration_seconds." }, { "id": 8, "type": "timeseries", "title": "Réponses par classe de statut", "gridPos": { "x": 12, "y": 12, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (status) (rate(http_requests_total{job=\"backend\"}[1m]))", "legendFormat": "{{status}}", "range": true } ], "fieldConfig": { "defaults": { "unit": "reqps" }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "id": 9, "type": "timeseries", "title": "Mémoire du processus API", "gridPos": { "x": 0, "y": 20, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "process_resident_memory_bytes{job=\"backend\"}", "legendFormat": "résidente", "range": true } ], "fieldConfig": { "defaults": { "unit": "bytes" }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "id": 10, "type": "timeseries", "title": "Requêtes en cours de traitement", "gridPos": { "x": 12, "y": 20, "w": 12, "h": 8 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(http_request_duration_highr_seconds_sum{job=\"backend\"}[1m]))", "legendFormat": "secondes de traitement par seconde", "range": true } ], "fieldConfig": { "defaults": { "unit": "short" }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "description": "Loi de Little : durée moyenne multipliée par le débit, soit le nombre moyen de requêtes simultanées." } ] }