{ "uid": "messenger-lab6", "title": "Messenger — lab6 observability", "tags": [ "messenger", "lab6" ], "timezone": "browser", "editable": false, "graphTooltip": 1, "schemaVersion": 39, "version": 1, "refresh": "10s", "time": { "from": "now-30m", "to": "now" }, "templating": { "list": [] }, "annotations": { "list": [ { "builtIn": 1, "datasource": { "type": "grafana", "uid": "-- Grafana --" }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "panels": [ { "type": "row", "title": "Обзор и SLO (окно SLO — 1 час)", "id": 2, "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 }, "panels": [] }, { "type": "stat", "id": 3, "title": "RPS API", "description": "Бизнес-запросы API в секунду (без /health), все реплики.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 4, "w": 3, "x": 0, "y": 1 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "messenger:http_requests:rate1m", "legendFormat": "__auto", "refId": "A", "range": false, "instant": 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": "none", "textMode": "value" } }, { "type": "stat", "id": 4, "title": "Доля 5xx (1m)", "description": "5xx / все бизнес-запросы за 1 минуту. Порог алерта 5%.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 4, "w": 3, "x": 3, "y": 1 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "messenger:http_error_ratio:rate1m", "legendFormat": "__auto", "refId": "A", "range": false, "instant": 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" }, "decimals": 2 }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "none", "textMode": "value" } }, { "type": "stat", "id": 5, "title": "p95 API (5m)", "description": "95-й перцентиль из buckets гистограммы всех реплик (не среднее p95).", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 4, "w": 3, "x": 6, "y": 1 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "messenger:http_request_duration_seconds:p95_5m", "legendFormat": "__auto", "refId": "A", "range": false, "instant": true } ], "fieldConfig": { "defaults": { "unit": "s", "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "orange", "value": 0.25 }, { "color": "red", "value": 1 } ] }, "color": { "mode": "thresholds" } }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "none", "textMode": "value" } }, { "type": "stat", "id": 6, "title": "Старейшее задание", "description": "Возраст старейшего готового к обработке задания (queue lag). Порог алерта 30 с.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 4, "w": 3, "x": 9, "y": 1 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max(messenger_queue_oldest_age_seconds{messaging_destination_name=\"attachments.process.v1\"})", "legendFormat": "__auto", "refId": "A", "range": false, "instant": true } ], "fieldConfig": { "defaults": { "unit": "s", "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "orange", "value": 10 }, { "color": "red", "value": 30 } ] }, "color": { "mode": "thresholds" } }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "none", "textMode": "value" } }, { "type": "stat", "id": 7, "title": "SLO-1 доступность", "description": "Доля бизнес-запросов без 5xx за 1 час. Цель 99%.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 4, "w": 3, "x": 12, "y": 1 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "messenger:slo_availability:ratio_1h", "legendFormat": "__auto", "refId": "A", "range": false, "instant": true } ], "fieldConfig": { "defaults": { "unit": "percentunit", "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "green", "value": 0.99 } ] }, "color": { "mode": "thresholds" }, "decimals": 2 }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "none", "textMode": "value" } }, { "type": "stat", "id": 8, "title": "Бюджет ошибок SLO-1", "description": "Остаток бюджета ошибок (1% запросов) за 1 час; < 0 — SLO нарушен.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 4, "w": 3, "x": 15, "y": 1 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "messenger:slo_availability:error_budget_remaining_1h", "legendFormat": "__auto", "refId": "A", "range": false, "instant": true } ], "fieldConfig": { "defaults": { "unit": "percentunit", "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "orange", "value": 0 }, { "color": "green", "value": 0.5 } ] }, "color": { "mode": "thresholds" }, "decimals": 0 }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "none", "textMode": "value" } }, { "type": "stat", "id": 9, "title": "SLO-2 POST < 250 мс", "description": "Доля успешных POST /chats/{chat_id}/messages быстрее 250 мс за 1 час. Цель 95%.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 4, "w": 3, "x": 18, "y": 1 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "messenger:slo_latency_messages:ratio_1h", "legendFormat": "__auto", "refId": "A", "range": false, "instant": true } ], "fieldConfig": { "defaults": { "unit": "percentunit", "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "green", "value": 0.95 } ] }, "color": { "mode": "thresholds" }, "decimals": 2 }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "none", "textMode": "value" } }, { "type": "stat", "id": 10, "title": "SLO-3 ready ≤ 30 с", "description": "Доля вложений, ставших ready не позже 30 с после 202, за 1 час. Цель 95%.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 4, "w": 3, "x": 21, "y": 1 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "messenger:slo_time_to_ready:ratio_1h", "legendFormat": "__auto", "refId": "A", "range": false, "instant": true } ], "fieldConfig": { "defaults": { "unit": "percentunit", "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "green", "value": 0.95 } ] }, "color": { "mode": "thresholds" }, "decimals": 2 }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "none", "textMode": "value" } }, { "type": "table", "id": 11, "title": "Алерты Prometheus (pending/firing)", "description": "ALERTS из Prometheus: имя, состояние, severity. Пусто — все правила inactive.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 5, "w": 24, "x": 0, "y": 5 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "ALERTS{alertstate=~\"pending|firing\"}", "legendFormat": "__auto", "refId": "A", "range": false, "instant": true, "format": "table" } ], "transformations": [ { "id": "organize", "options": { "excludeByName": { "Time": true, "Value": true, "__name__": true } } } ], "fieldConfig": { "defaults": {}, "overrides": [] }, "options": { "showHeader": true } }, { "type": "row", "title": "API: запросы, ошибки, задержка (RED)", "id": 12, "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 10 }, "panels": [] }, { "type": "timeseries", "id": 13, "title": "RPS по маршрутам", "description": "Шаблон маршрута, а не URL: метка ограниченной кардинальности.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 0, "y": 11 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (http_request_method, http_route) (rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval]))", "legendFormat": "{{http_request_method}} {{http_route}}", "refId": "A", "range": true, "instant": false } ], "fieldConfig": { "defaults": { "unit": "reqps", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none" } } }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "type": "timeseries", "id": 14, "title": "RPS по классу статуса", "description": "2xx/4xx/5xx. 4xx — ошибки клиента, в SLO не входят.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 8, "y": 11 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (http_response_status_class) (rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval]))", "legendFormat": "{{http_response_status_class}}", "refId": "A", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 15, "title": "Доля 5xx", "description": "Числитель: 5xx бизнес-запросов; знаменатель: все бизнес-запросы. Линия — порог алерта.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 16, "y": 11 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "(sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_response_status_class=\"5xx\"}[$__rate_interval])) or on() vector(0)) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval]))", "legendFormat": "5xx ratio", "refId": "A", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 16, "title": "Задержка API p50 / p95 / p99", "description": "histogram_quantile по сумме buckets всех реплик.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 0, "y": 19 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.5, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval])))", "legendFormat": "p50", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval])))", "legendFormat": "p95", "refId": "B", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval])))", "legendFormat": "p99", "refId": "C", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 17, "title": "p95 по маршрутам", "description": "Где именно медленно.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 8, "y": 19 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le, http_route) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval])))", "legendFormat": "{{http_route}}", "refId": "A", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 18, "title": "Запросы в обработке (по репликам)", "description": "http.server.active_requests: насыщение реплик API.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 16, "y": 19 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (instance) (http_server_active_requests{job=\"messenger-api\"})", "legendFormat": "{{instance}}", "refId": "A", "range": true, "instant": false } ], "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none" } } }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "type": "row", "title": "Фоновая обработка: очередь, worker, время до ready", "id": 19, "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 27 }, "panels": [] }, { "type": "timeseries", "id": 20, "title": "Попытки заданий в секунду по исходу", "description": "ready / retry / failed / stale / lease_lost (messenger.job.duration count).", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 0, "y": 28 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (outcome) (rate(messenger_job_duration_seconds_count[$__rate_interval]))", "legendFormat": "{{outcome}}", "refId": "A", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 21, "title": "Длительность попытки p50 / p95 / p99 (ready)", "description": "От claim до COMMIT ready в worker.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 8, "y": 28 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"ready\"}[$__rate_interval])))", "legendFormat": "p50", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"ready\"}[$__rate_interval])))", "legendFormat": "p95", "refId": "B", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"ready\"}[$__rate_interval])))", "legendFormat": "p99", "refId": "C", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 22, "title": "Время до ready p50 / p95 / p99", "description": "От устойчивого приёма (COMMIT задания в API) до COMMIT ready. Линия — SLO-3 (30 с).", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 16, "y": 28 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket{job_type=\"attachment.process.v1\"}[$__rate_interval])))", "legendFormat": "p50", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket{job_type=\"attachment.process.v1\"}[$__rate_interval])))", "legendFormat": "p95", "refId": "B", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket{job_type=\"attachment.process.v1\"}[$__rate_interval])))", "legendFormat": "p99", "refId": "C", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 23, "title": "Глубина очереди и backlog", "description": "Сообщения в RabbitMQ (очередь и DLQ) и незавершённые задания в PostgreSQL.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 0, "y": 36 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max by (messaging_destination_name) (messenger_queue_depth)", "legendFormat": "broker {{messaging_destination_name}}", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max by (status) (messenger_jobs_backlog)", "legendFormat": "jobs {{status}}", "refId": "B", "range": true, "instant": false } ], "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none" } } }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "type": "timeseries", "id": 24, "title": "Возраст старейшего задания и outbox", "description": "Queue lag (worker не успевает) и publish lag (dispatcher/брокер). Линия — порог алерта.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 8, "y": 36 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max(messenger_queue_oldest_age_seconds{messaging_destination_name=\"attachments.process.v1\"})", "legendFormat": "oldest queued job", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max(messenger_outbox_oldest_age_seconds)", "legendFormat": "oldest unpublished outbox row", "refId": "B", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 25, "title": "Доставки и публикации", "description": "Worker: processed / noop / dead_lettered / requeued; dispatcher: ok / error.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 16, "y": 36 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (outcome) (rate(messenger_messages_consumed_total[$__rate_interval]))", "legendFormat": "consumed {{outcome}}", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (outcome) (rate(messenger_messages_published_total[$__rate_interval]))", "legendFormat": "published {{outcome}}", "refId": "B", "range": true, "instant": false } ], "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" } } }, { "type": "row", "title": "Насыщение: пул БД, worker, CPU/RAM", "id": 26, "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 44 }, "panels": [] }, { "type": "timeseries", "id": 27, "title": "Пул PostgreSQL API: занято / максимум / ждут", "description": "used растёт до max и появляются ждущие — запросы ждут соединение (медленная БД или блокировки).", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 0, "y": 45 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (instance) (db_client_connection_count{db_client_connection_state=\"used\"})", "legendFormat": "used {{instance}}", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max(db_client_connection_max)", "legendFormat": "max per replica", "refId": "B", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (instance) (db_client_connection_pending_requests)", "legendFormat": "waiting {{instance}}", "refId": "C", "range": true, "instant": false } ], "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none" } } }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "type": "timeseries", "id": 28, "title": "Ожидание соединения из пула p95", "description": "Время получения соединения из пула API (не время запроса).", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 8, "y": 45 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le, instance) (rate(db_client_connection_wait_time_seconds_bucket[$__rate_interval])))", "legendFormat": "p95 {{instance}}", "refId": "A", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 29, "title": "Worker: занятость (busy / capacity)", "description": "Доля занятых потоков-потребителей. 100% — worker насыщен, очередь растёт.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 16, "y": 45 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(messenger_worker_busy) / sum(messenger_worker_capacity)", "legendFormat": "saturation", "refId": "A", "range": true, "instant": false } ], "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": "orange", "value": 0.8 }, { "color": "red", "value": 1 } ] } }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "type": "timeseries", "id": 30, "title": "CPU процессов (ядра)", "description": "rate(process.cpu.time): ядер на процесс.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 0, "y": 53 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job, instance) (rate(process_cpu_time_seconds_total[$__rate_interval]))", "legendFormat": "{{job}} {{instance}}", "refId": "A", "range": true, "instant": false } ], "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none" } } }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } } }, { "type": "timeseries", "id": 31, "title": "CPU контейнеров / лимит", "description": "cgroup v2 (только в Docker): доля лимита CPU контейнера, включая дочерние процессы worker.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 8, "y": 53 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job, instance) (rate(container_cpu_time_seconds_total[$__rate_interval])) / on (job, instance) max by (job, instance) (container_cpu_limit)", "legendFormat": "{{job}} {{instance}}", "refId": "A", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 32, "title": "Память: RSS процесса и контейнер", "description": "process.memory.usage (RSS) и container.memory.usage (cgroup).", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 16, "y": 53 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max by (job, instance) (process_memory_usage_bytes)", "legendFormat": "rss {{job}} {{instance}}", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max by (job, instance) (container_memory_usage_bytes)", "legendFormat": "cgroup {{job}} {{instance}}", "refId": "B", "range": true, "instant": false } ], "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" } } }, { "type": "row", "title": "Конвейер телеметрии: Collector и SDK", "id": 33, "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 61 }, "panels": [] }, { "type": "timeseries", "id": 34, "title": "Collector: принято и отправлено", "description": "Спаны/записи логов/точки метрик в секунду.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 0, "y": 62 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_receiver_accepted_spans[$__rate_interval]))", "legendFormat": "accepted spans", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_receiver_accepted_log_records[$__rate_interval]))", "legendFormat": "accepted logs", "refId": "B", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_receiver_accepted_metric_points[$__rate_interval]))", "legendFormat": "accepted metric points", "refId": "C", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (exporter) (rate(otelcol_exporter_sent_spans[$__rate_interval]))", "legendFormat": "sent spans {{exporter}}", "refId": "D", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (exporter) (rate(otelcol_exporter_sent_log_records[$__rate_interval]))", "legendFormat": "sent logs {{exporter}}", "refId": "E", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 35, "title": "Collector: потери и отказы", "description": "send_failed — истёк повтор; enqueue_failed — очередь полна; refused — memory_limiter.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 8, "y": 62 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (exporter) (rate(otelcol_exporter_send_failed_spans[$__rate_interval]))", "legendFormat": "send failed spans {{exporter}}", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (exporter) (rate(otelcol_exporter_send_failed_log_records[$__rate_interval]))", "legendFormat": "send failed logs {{exporter}}", "refId": "B", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (exporter) (rate(otelcol_exporter_enqueue_failed_spans[$__rate_interval]))", "legendFormat": "queue full spans {{exporter}}", "refId": "C", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_receiver_refused_spans[$__rate_interval]))", "legendFormat": "refused spans (memory_limiter)", "refId": "D", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 36, "title": "Очереди exporter и RSS Collector", "description": "Заполнение sending_queue (доля ёмкости) и память процесса Collector.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 8, "x": 16, "y": 62 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max by (exporter) (otelcol_exporter_queue_size / otelcol_exporter_queue_capacity)", "legendFormat": "queue {{exporter}}", "refId": "A", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 37, "title": "Collector RSS", "description": "Ограничено memory_limiter (200 MiB) при недоступном хранилище.", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 12, "x": 0, "y": 70 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max(otelcol_process_memory_rss)", "legendFormat": "collector rss", "refId": "A", "range": true, "instant": false } ], "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" } } }, { "type": "timeseries", "id": 38, "title": "SDK приложений: экспорт и потери", "description": "Потери в процессе приложения: processor error.type=queue_full (очередь 2048 полна), exporter error.type (Collector не принял пакет).", "datasource": { "type": "prometheus", "uid": "prometheus" }, "gridPos": { "h": 8, "w": 12, "x": 12, "y": 70 }, "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job) (rate(otel_sdk_exporter_span_exported_total{error_type=\"\"}[$__rate_interval]))", "legendFormat": "exported spans {{job}}", "refId": "A", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job, error_type) (rate(otel_sdk_exporter_span_exported_total{error_type!=\"\"}[$__rate_interval]))", "legendFormat": "export failed spans {{job}} {{error_type}}", "refId": "B", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job, error_type) (rate(otel_sdk_exporter_log_exported_total{error_type!=\"\"}[$__rate_interval]))", "legendFormat": "export failed logs {{job}} {{error_type}}", "refId": "C", "range": true, "instant": false }, { "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job) (rate(otel_sdk_processor_span_processed_total{error_type!=\"\"}[$__rate_interval]))", "legendFormat": "queue full spans {{job}}", "refId": "D", "range": true, "instant": false } ], "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" } } }, { "type": "row", "title": "Логи и трассы", "id": 39, "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 78 }, "panels": [] }, { "type": "logs", "id": 40, "title": "Предупреждения и ошибки (Loki)", "description": "Структурные логи всех сервисов; trace_id в записи ведёт в Tempo.", "datasource": { "type": "loki", "uid": "loki" }, "gridPos": { "h": 9, "w": 12, "x": 0, "y": 79 }, "targets": [ { "datasource": { "type": "loki", "uid": "loki" }, "refId": "A", "queryType": "range", "expr": "{service_name=~\"messenger-.*\"} | detected_level=~\"warn|error\"" } ], "options": { "showTime": true, "wrapLogMessage": true, "sortOrder": "Descending", "enableLogDetails": true } }, { "type": "table", "id": 41, "title": "Трассы с ошибками (Tempo, TraceQL)", "description": "Последние трассы со статусом ERROR: 5xx API, неудачные попытки заданий.", "datasource": { "type": "tempo", "uid": "tempo" }, "gridPos": { "h": 9, "w": 12, "x": 12, "y": 79 }, "targets": [ { "datasource": { "type": "tempo", "uid": "tempo" }, "refId": "A", "queryType": "traceql", "query": "{ status = error }", "limit": 20, "tableType": "traces" } ], "fieldConfig": { "defaults": {}, "overrides": [] }, "options": { "showHeader": true } } ] }