Files
mtusi2026lab7/infra/grafana/dashboards/messenger.json
T

1953 lines
48 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"uid": "messenger-lab6",
"title": "Messenger lab6",
"tags": [
"messenger",
"lab6",
"slo"
],
"description": "API, worker, очередь, насыщение, SLO/burn rate, telemetry pipeline. Морару С. С., БПИ2303.",
"timezone": "browser",
"refresh": "10s",
"schemaVersion": 41,
"version": 1,
"editable": false,
"time": {
"from": "now-1h",
"to": "now"
},
"templating": {
"list": []
},
"annotations": {
"list": []
},
"panels": [
{
"type": "row",
"title": "SLO и alerts (трек 2)",
"collapsed": false,
"panels": [],
"gridPos": {
"x": 0,
"y": 0,
"w": 24,
"h": 1
},
"id": 1
},
{
"type": "stat",
"title": "Доступность API у клиентов, 1 ч",
"description": "SLI = 1 − 5xx/все ответы HAProxy (frontend public) за 1 ч: включает 503/504 самого LB, которых не видит API. SLO 99.5 % за 30 дней.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 0.995
}
]
},
"decimals": 2
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "area",
"textMode": "value"
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "1 - slo:api_error_ratio:rate1h",
"instant": false
}
],
"gridPos": {
"x": 0,
"y": 1,
"w": 4,
"h": 5
},
"id": 2
},
{
"type": "stat",
"title": "Остаток бюджета API (30 д)",
"description": "Доля неизрасходованного бюджета ошибок 0.5 % за 30 дней (на стенде — за доступную историю).",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 0
}
]
},
"decimals": 1
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "area",
"textMode": "value"
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "1 - slo:api_error_ratio:rate30d / 0.005",
"instant": false
}
],
"gridPos": {
"x": 4,
"y": 1,
"w": 4,
"h": 5
},
"id": 3
},
{
"type": "stat",
"title": "Ready ≤ 30 с, 1 ч",
"description": "SLI time-to-ready: доля вложений, ставших ready не позже 30 с от приёма. SLO 99 %.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 0.99
}
]
},
"decimals": 2
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "area",
"textMode": "value"
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "1 - slo:ready_bad_ratio:rate1h",
"instant": false
}
],
"gridPos": {
"x": 8,
"y": 1,
"w": 4,
"h": 5
},
"id": 4
},
{
"type": "stat",
"title": "Остаток бюджета time-to-ready (30 д)",
"description": "Бюджет 1 % «медленных» или failed вложений за 30 дней.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 0
}
]
},
"decimals": 1
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "area",
"textMode": "value"
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "1 - slo:ready_bad_ratio:rate30d / 0.01",
"instant": false
}
],
"gridPos": {
"x": 12,
"y": 1,
"w": 4,
"h": 5
},
"id": 5
},
{
"type": "stat",
"title": "Alerts firing",
"description": "Сейчас активных alerts.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"colorMode": "background",
"graphMode": "area",
"textMode": "value"
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "count(ALERTS{alertstate=\"firing\"}) or vector(0)",
"instant": false
}
],
"gridPos": {
"x": 16,
"y": 1,
"w": 4,
"h": 5
},
"id": 6
},
{
"type": "timeseries",
"title": "Burn rate API (×бюджет)",
"description": "Расход бюджета относительно равномерного. Fast burn: 1h и 5m > 14.4; slow burn: 6h и 30m > 6.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 6
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:api_error_ratio:rate5m / 0.005",
"legendFormat": "5m"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:api_error_ratio:rate30m / 0.005",
"legendFormat": "30m"
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:api_error_ratio:rate1h / 0.005",
"legendFormat": "1h"
},
{
"refId": "D",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:api_error_ratio:rate6h / 0.005",
"legendFormat": "6h"
}
],
"gridPos": {
"x": 0,
"y": 6,
"w": 8,
"h": 8
},
"id": 7
},
{
"type": "timeseries",
"title": "Burn rate time-to-ready (×бюджет)",
"description": "Fast burn: 1h и 5m > 14.4; slow burn: 6h и 30m > 6.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 6
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:ready_bad_ratio:rate5m / 0.01",
"legendFormat": "5m"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:ready_bad_ratio:rate30m / 0.01",
"legendFormat": "30m"
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:ready_bad_ratio:rate1h / 0.01",
"legendFormat": "1h"
},
{
"refId": "D",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:ready_bad_ratio:rate6h / 0.01",
"legendFormat": "6h"
}
],
"gridPos": {
"x": 8,
"y": 6,
"w": 8,
"h": 8
},
"id": 8
},
{
"type": "state-timeline",
"title": "Alerts (pending / firing)",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"description": "Серия ALERTS: состояние правил Prometheus. Отсутствие полосы — alert неактивен (resolved).",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "transparent",
"value": null
},
{
"color": "orange",
"value": 1
},
{
"color": "red",
"value": 2
}
]
}
},
"overrides": []
},
"options": {
"showValue": "never",
"mergeValues": true,
"rowHeight": 0.8,
"legend": {
"showLegend": false
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"legendFormat": "{{alertname}}",
"expr": "max by (alertname) ((ALERTS{alertstate=\"pending\"} * 1) or (ALERTS{alertstate=\"firing\"} * 2))"
}
],
"gridPos": {
"x": 16,
"y": 6,
"w": 8,
"h": 8
},
"id": 9
},
{
"type": "row",
"title": "API: запросы, ошибки, задержка",
"collapsed": false,
"panels": [],
"gridPos": {
"x": 0,
"y": 14,
"w": 24,
"h": 1
},
"id": 10
},
{
"type": "timeseries",
"title": "RPS по маршрутам",
"description": "http.server.request.duration (_count) — счётчик запросов; label http_route — шаблон маршрута.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "reqps",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "normal"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (http_route, http_request_method) (rate(http_server_request_duration_seconds_count{job=\"messenger-api\"}[$__rate_interval]))",
"legendFormat": "{{http_request_method}} {{http_route}}"
}
],
"gridPos": {
"x": 0,
"y": 15,
"w": 8,
"h": 8
},
"id": 11
},
{
"type": "timeseries",
"title": "RPS по классу статуса",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "reqps",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "normal"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (status_class) (label_replace(rate(http_server_request_duration_seconds_count{job=\"messenger-api\"}[$__rate_interval]), \"status_class\", \"${1}xx\", \"http_response_status_code\", \"([0-9])..\"))",
"legendFormat": "{{status_class}}"
}
],
"gridPos": {
"x": 8,
"y": 15,
"w": 8,
"h": 8
},
"id": 12
},
{
"type": "timeseries",
"title": "Доля 5xx",
"description": "5xx / все ответы; 4xx — не ошибка сервиса. Линия API ниже линии HAProxy, когда LB отвечает сам: 503 без готовых реплик (БД недоступна → readiness), 504 по таймауту.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 0.05
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "(sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\",http_response_status_code=~\"5..\"}[$__rate_interval])) or vector(0)) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\"}[$__rate_interval]))",
"legendFormat": "в метриках API"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:api_error_ratio:rate5m",
"legendFormat": "у клиентов (HAProxy), 5m — SLI, alert > 5 %"
}
],
"gridPos": {
"x": 16,
"y": 15,
"w": 8,
"h": 8
},
"id": 13
},
{
"type": "timeseries",
"title": "Задержка API p50/p95/p99",
"description": "Квантили из buckets histogram всех реплик (sum by le).",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.5, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[$__rate_interval])))",
"legendFormat": "p50"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[$__rate_interval])))",
"legendFormat": "p95"
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[$__rate_interval])))",
"legendFormat": "p99"
}
],
"gridPos": {
"x": 0,
"y": 23,
"w": 8,
"h": 8
},
"id": 14
},
{
"type": "timeseries",
"title": "p99 по маршрутам",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le, http_route) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[$__rate_interval])))",
"legendFormat": "{{http_route}}"
}
],
"gridPos": {
"x": 8,
"y": 23,
"w": 8,
"h": 8
},
"id": 15
},
{
"type": "timeseries",
"title": "p99 запросов к PostgreSQL",
"description": "db.client.operation.duration (instrumentation-pg). Медленная БД — растёт здесь; медленный handler — нет.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le, job) (rate(db_client_operation_duration_seconds_bucket[$__rate_interval])))",
"legendFormat": "{{job}}"
}
],
"gridPos": {
"x": 16,
"y": 23,
"w": 8,
"h": 8
},
"id": 16
},
{
"type": "row",
"title": "Worker и задания",
"collapsed": false,
"panels": [],
"gridPos": {
"x": 0,
"y": 31,
"w": 24,
"h": 1
},
"id": 17
},
{
"type": "timeseries",
"title": "Jobs/с по исходу",
"description": "done — ready; retry — временная ошибка, повтор; failed — терминально; noop/discarded — дубль/потерянная аренда.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "ops",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "normal"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (outcome) (rate(messenger_job_duration_seconds_count[$__rate_interval]))",
"legendFormat": "{{outcome}}"
}
],
"gridPos": {
"x": 0,
"y": 32,
"w": 8,
"h": 8
},
"id": 18
},
{
"type": "timeseries",
"title": "Длительность обработки job (done) p50/p95/p99",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"done\"}[$__rate_interval])))",
"legendFormat": "p50"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"done\"}[$__rate_interval])))",
"legendFormat": "p95"
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"done\"}[$__rate_interval])))",
"legendFormat": "p99"
}
],
"gridPos": {
"x": 8,
"y": 32,
"w": 8,
"h": 8
},
"id": 19
},
{
"type": "timeseries",
"title": "Время до ready p50/p95/p99",
"description": "От durable acceptance (COMMIT задания) до публикации ready. Порог SLO — 30 с.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 30
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket{outcome=\"ready\"}[$__rate_interval])))",
"legendFormat": "p50"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket{outcome=\"ready\"}[$__rate_interval])))",
"legendFormat": "p95"
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket{outcome=\"ready\"}[$__rate_interval])))",
"legendFormat": "p99"
}
],
"gridPos": {
"x": 16,
"y": 32,
"w": 8,
"h": 8
},
"id": 20
},
{
"type": "timeseries",
"title": "Насыщение worker (busy / capacity)",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
},
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_worker_busy) / sum(messenger_worker_capacity)",
"legendFormat": "все worker"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "messenger_worker_busy / messenger_worker_capacity",
"legendFormat": "{{instance}}"
}
],
"gridPos": {
"x": 0,
"y": 40,
"w": 8,
"h": 8
},
"id": 21
},
{
"type": "timeseries",
"title": "Очередь: backlog",
"description": "Количество работы (backlog). БД — источник истины; одинаково видна со всех реплик API, берётся max.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (state) (messenger_jobs_backlog)",
"legendFormat": "jobs {{state}} (БД)"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max(messenger_outbox_pending)",
"legendFormat": "outbox без confirm"
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rabbitmq_detailed_queue_messages_ready{queue=\"attachments.process\"})",
"legendFormat": "RabbitMQ ready"
},
{
"refId": "D",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rabbitmq_detailed_queue_messages_unacked{queue=\"attachments.process\"})",
"legendFormat": "RabbitMQ unacked"
}
],
"gridPos": {
"x": 8,
"y": 40,
"w": 8,
"h": 8
},
"id": 22
},
{
"type": "timeseries",
"title": "Возраст старейшего задания",
"description": "Секунды с приёма старейшего незавершённого задания (lag). Alert JobQueueLagGrowing — > 60 с в течение 1 мин.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 60
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (queue) (messenger_jobs_oldest_age_seconds)",
"legendFormat": "{{queue}}"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rabbitmq_detailed_queue_consumers{queue=\"attachments.process\"})",
"legendFormat": "consumers"
}
],
"gridPos": {
"x": 16,
"y": 40,
"w": 8,
"h": 8
},
"id": 23
},
{
"type": "row",
"title": "Насыщение: пул БД, CPU, память, event loop",
"collapsed": false,
"panels": [],
"gridPos": {
"x": 0,
"y": 48,
"w": 24,
"h": 1
},
"id": 24
},
{
"type": "timeseries",
"title": "Пул соединений PostgreSQL",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (job, db_client_connection_state) (db_client_connection_count)",
"legendFormat": "{{job}} {{db_client_connection_state}}"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (job) (db_client_connection_pending_requests)",
"legendFormat": "{{job}} ждут соединения"
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (job) (db_client_connection_max)",
"legendFormat": "{{job}} max"
}
],
"gridPos": {
"x": 0,
"y": 49,
"w": 6,
"h": 8
},
"id": 25
},
{
"type": "timeseries",
"title": "CPU процессов (доля ядра)",
"description": "process.cpu.time; 100 % = одно ядро. Лимит контейнера api/worker — 1 CPU.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (job, instance) (rate(process_cpu_time_seconds_total[$__rate_interval]))",
"legendFormat": "{{job}} {{instance}}"
}
],
"gridPos": {
"x": 6,
"y": 49,
"w": 6,
"h": 8
},
"id": 26
},
{
"type": "timeseries",
"title": "Память процессов (RSS)",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "bytes",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "process_memory_usage_bytes",
"legendFormat": "{{job}} {{instance}}"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "otelcol_process_memory_rss",
"legendFormat": "collector"
}
],
"gridPos": {
"x": 12,
"y": 49,
"w": 6,
"h": 8
},
"id": 27
},
{
"type": "timeseries",
"title": "Event loop: задержка p99",
"description": "Блокировка event loop Node.js (CPU-bound handler) — растёт здесь, а не в p99 PostgreSQL.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "nodejs_eventloop_delay_p99_seconds",
"legendFormat": "{{job}} {{instance}}"
}
],
"gridPos": {
"x": 18,
"y": 49,
"w": 6,
"h": 8
},
"id": 28
},
{
"type": "row",
"title": "Telemetry pipeline (OpenTelemetry Collector)",
"collapsed": false,
"panels": [],
"gridPos": {
"x": 0,
"y": 57,
"w": 24,
"h": 1
},
"id": 29
},
{
"type": "timeseries",
"title": "Принято / отправлено (элементов/с)",
"description": "",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "ops",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(otelcol_receiver_accepted_spans_total[$__rate_interval]))",
"legendFormat": "spans принято"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(otelcol_exporter_sent_spans_total[$__rate_interval]))",
"legendFormat": "spans отправлено"
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(otelcol_receiver_accepted_log_records_total[$__rate_interval]))",
"legendFormat": "logs принято"
},
{
"refId": "D",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(otelcol_exporter_sent_log_records_total[$__rate_interval]))",
"legendFormat": "logs отправлено"
},
{
"refId": "E",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(otelcol_receiver_accepted_metric_points_total[$__rate_interval]))",
"legendFormat": "metric points принято"
},
{
"refId": "F",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(otelcol_exporter_sent_metric_points_total[$__rate_interval]))",
"legendFormat": "metric points отправлено"
}
],
"gridPos": {
"x": 0,
"y": 58,
"w": 8,
"h": 8
},
"id": 30
},
{
"type": "timeseries",
"title": "Потери telemetry (элементов/с)",
"description": "Отброшенное Collector-ом: после 60 с повторов (send failed) или при полной очереди (enqueue failed).",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "ops",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (exporter) (rate(otelcol_exporter_send_failed_spans_total[$__rate_interval]))",
"legendFormat": "send failed spans {{exporter}}"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (exporter) (rate(otelcol_exporter_send_failed_log_records_total[$__rate_interval]))",
"legendFormat": "send failed logs {{exporter}}"
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (exporter) (rate(otelcol_exporter_enqueue_failed_spans_total[$__rate_interval]))",
"legendFormat": "очередь полна, spans {{exporter}}"
},
{
"refId": "D",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (exporter) (rate(otelcol_exporter_enqueue_failed_log_records_total[$__rate_interval]))",
"legendFormat": "очередь полна, logs {{exporter}}"
},
{
"refId": "E",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(otelcol_receiver_refused_spans_total[$__rate_interval]))",
"legendFormat": "отказ приёма spans (memory_limiter)"
}
],
"gridPos": {
"x": 8,
"y": 58,
"w": 8,
"h": 8
},
"id": 31
},
{
"type": "timeseries",
"title": "Очередь экспортёров",
"description": "Ограниченная очередь в памяти: при недоступном backend растёт до ёмкости, не дальше.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"custom": {
"lineWidth": 1,
"fillOpacity": 10,
"showPoints": "never",
"stacking": {
"mode": "none"
}
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "otelcol_exporter_queue_size",
"legendFormat": "{{exporter}}"
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max(otelcol_exporter_queue_capacity)",
"legendFormat": "ёмкость"
}
],
"gridPos": {
"x": 16,
"y": 58,
"w": 8,
"h": 8
},
"id": 32
},
{
"type": "row",
"title": "Логи и трассы",
"collapsed": false,
"panels": [],
"gridPos": {
"x": 0,
"y": 66,
"w": 24,
"h": 1
},
"id": 33
},
{
"type": "logs",
"title": "Ошибки и предупреждения (Loki)",
"datasource": {
"type": "loki",
"uid": "loki"
},
"description": "Структурные логи api и worker; поле trace_id ведёт в Tempo.",
"options": {
"showTime": true,
"wrapLogMessage": true,
"sortOrder": "Descending",
"enableLogDetails": true
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "{service_name=~\"messenger-.+\"} | severity_text=~\"ERROR|WARN\""
}
],
"gridPos": {
"x": 0,
"y": 67,
"w": 12,
"h": 10
},
"id": 34
},
{
"type": "table",
"title": "Трассы с ошибками (Tempo)",
"datasource": {
"type": "tempo",
"uid": "tempo"
},
"description": "TraceQL { status = error }: ошибки HTTP 5xx, повторы и отказы обработки заданий.",
"targets": [
{
"refId": "A",
"datasource": {
"type": "tempo",
"uid": "tempo"
},
"queryType": "traceql",
"query": "{ status = error }",
"limit": 20,
"tableType": "traces"
}
],
"gridPos": {
"x": 12,
"y": 67,
"w": 12,
"h": 10
},
"id": 35
}
]
}