forked from mtusi2026/mtusi2026lab6
1582 lines
41 KiB
JSON
1582 lines
41 KiB
JSON
{
|
||
"uid": "messenger-lab6",
|
||
"title": "Messenger lab6: API, worker, очередь, SLO",
|
||
"tags": [
|
||
"lab6",
|
||
"messenger"
|
||
],
|
||
"timezone": "browser",
|
||
"schemaVersion": 41,
|
||
"version": 1,
|
||
"editable": true,
|
||
"refresh": "10s",
|
||
"time": {
|
||
"from": "now-30m",
|
||
"to": "now"
|
||
},
|
||
"templating": {
|
||
"list": []
|
||
},
|
||
"annotations": {
|
||
"list": []
|
||
},
|
||
"panels": [
|
||
{
|
||
"type": "row",
|
||
"title": "SLO и alerts (окно SLO — 1 час)",
|
||
"id": 1,
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 0
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"type": "stat",
|
||
"title": "SLO-1 доступность API, 1 ч (цель ≥ 99%)",
|
||
"description": "Доля ответов клиентам без 5xx на входе HAProxy за последний час. Источник: haproxy_frontend_http_responses_total.",
|
||
"id": 2,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 5,
|
||
"w": 6,
|
||
"x": 0,
|
||
"y": 1
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "percentunit",
|
||
"decimals": 3,
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "red",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "green",
|
||
"value": 0.99
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
],
|
||
"fields": "",
|
||
"values": false
|
||
},
|
||
"colorMode": "background",
|
||
"graphMode": "area",
|
||
"textMode": "auto"
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "messenger:edge_availability:ratio1h",
|
||
"instant": false
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "stat",
|
||
"title": "SLO-2 p95 задержки API, 5 мин (цель < 0.5 с)",
|
||
"description": "p95 из buckets гистограммы http.server.request.duration всех реплик (sum by le), без /health.",
|
||
"id": 3,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 5,
|
||
"w": 6,
|
||
"x": 6,
|
||
"y": 1
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"decimals": 3,
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 0.5
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
],
|
||
"fields": "",
|
||
"values": false
|
||
},
|
||
"colorMode": "background",
|
||
"graphMode": "area",
|
||
"textMode": "auto"
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "messenger:http_latency_p95:5m",
|
||
"instant": false
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "stat",
|
||
"title": "SLO-3 вложения ready < 30 с, 1 ч (цель ≥ 95%)",
|
||
"description": "Доля вложений, ставших ready быстрее 30 с от принятия загрузки (bucket le=30 / count).",
|
||
"id": 4,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 5,
|
||
"w": 6,
|
||
"x": 12,
|
||
"y": 1
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "percentunit",
|
||
"decimals": 3,
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "red",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "green",
|
||
"value": 0.95
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
],
|
||
"fields": "",
|
||
"values": false
|
||
},
|
||
"colorMode": "background",
|
||
"graphMode": "area",
|
||
"textMode": "auto"
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "messenger:time_to_ready_under_30s:ratio1h",
|
||
"instant": false
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "state-timeline",
|
||
"title": "Alerts: pending / firing",
|
||
"description": "Состояние alert rules Prometheus (infra/prometheus/rules/alerts.yml). 1 = alert в этом состоянии.",
|
||
"id": 5,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 5,
|
||
"w": 6,
|
||
"x": 18,
|
||
"y": 1
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "none",
|
||
"color": {
|
||
"mode": "thresholds"
|
||
},
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "transparent",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 1
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"showValue": "never",
|
||
"mergeValues": true,
|
||
"rowHeight": 0.8
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max by (alertname, alertstate) (ALERTS)",
|
||
"legendFormat": "{{alertname}} {{alertstate}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "row",
|
||
"title": "API: трафик, ошибки, задержка",
|
||
"id": 6,
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 6
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "RPS по маршрутам",
|
||
"description": "Бизнес-запросы в секунду по маршруту-шаблону (без /health). Единица: запросов/с.",
|
||
"id": 7,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 0,
|
||
"y": 7
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "reqps",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (http_route) (rate(http_server_request_duration_seconds_count{job=\"messenger-api\"}[1m]))",
|
||
"legendFormat": "{{http_route}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Ошибки: вход HAProxy и приложение (доля)",
|
||
"description": "Числитель — 5xx, знаменатель — все ответы. 4xx (неверный пароль, чужой чат) — не отказ сервиса. Если 5xx есть только на входе — HAProxy сам отвечает 503: нет готовых реплик.",
|
||
"id": 8,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 8,
|
||
"y": 7
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "percentunit",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false,
|
||
"thresholdsStyle": {
|
||
"mode": "line+area"
|
||
}
|
||
},
|
||
"min": 0,
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 0.05
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "messenger:edge_error_ratio:rate2m",
|
||
"legendFormat": "5xx на входе (HAProxy, SLI)"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\",http_response_status_code=~\"5..\"}[2m])) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\"}[2m]))",
|
||
"legendFormat": "5xx приложения"
|
||
},
|
||
{
|
||
"refId": "C",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\",http_response_status_code=~\"4..\"}[2m])) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\"}[2m]))",
|
||
"legendFormat": "4xx приложения (ошибки клиента)"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Задержка API p50 / p95 / p99",
|
||
"description": "Перцентили из buckets гистограммы всех реплик (sum by le), а не среднее и не среднее p95 реплик. Единица: секунды.",
|
||
"id": 9,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 16,
|
||
"y": 7
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false,
|
||
"thresholdsStyle": {
|
||
"mode": "line+area"
|
||
}
|
||
},
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 0.5
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.50, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[5m])))",
|
||
"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\"}[5m])))",
|
||
"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\"}[5m])))",
|
||
"legendFormat": "p99"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "p95 по маршрутам",
|
||
"description": "Какой обработчик медленный. Секунды.",
|
||
"id": 10,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 0,
|
||
"y": 15
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"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\"}[5m])))",
|
||
"legendFormat": "{{http_route}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Ответы клиентам по классам (HAProxy) и готовые реплики",
|
||
"description": "Ответов/с по классу кода на входе и число реплик, прошедших /health/ready.",
|
||
"id": 11,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 8,
|
||
"y": 15
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (code) (rate(haproxy_frontend_http_responses_total{proxy=\"api_in\"}[1m]))",
|
||
"legendFormat": "{{code}}"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "haproxy_backend_active_servers{proxy=\"api\"}",
|
||
"legendFormat": "готовых реплик API"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Запросы в обработке",
|
||
"description": "Одновременно выполняемые запросы на реплику.",
|
||
"id": 12,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 16,
|
||
"y": 15
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (instance) (http_server_active_requests{job=\"messenger-api\"})",
|
||
"legendFormat": "{{instance}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "row",
|
||
"title": "Очередь заданий и worker",
|
||
"id": 13,
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 23
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Глубина очереди (backlog)",
|
||
"description": "Сколько заданий ждёт (ready), в паузе перед повтором (delayed), в работе (processing). max по репликам API: обе считают одно и то же из PostgreSQL. Единица: задания.",
|
||
"id": 14,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 0,
|
||
"y": 24
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max by (state) (messenger_queue_depth{job=\"messenger-api\"})",
|
||
"legendFormat": "задания: {{state}}"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max(messenger_outbox_pending{job=\"messenger-api\"})",
|
||
"legendFormat": "outbox: ещё не в брокере"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Возраст старейшего задания (lag)",
|
||
"description": "Сколько ждёт самое старое задание, которое уже можно обрабатывать. Порог alert QueueLagHigh — 60 с. Это ожидание, а не время обработки.",
|
||
"id": 15,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 8,
|
||
"y": 24
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false,
|
||
"thresholdsStyle": {
|
||
"mode": "line+area"
|
||
}
|
||
},
|
||
"min": 0,
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 60
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max(messenger_queue_oldest_age_seconds{job=\"messenger-api\"})",
|
||
"legendFormat": "задание ждёт worker"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max(messenger_outbox_oldest_age_seconds{job=\"messenger-api\"})",
|
||
"legendFormat": "строка outbox ждёт брокер"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Задания по исходу",
|
||
"description": "Доставки, обработанные worker, в секунду: ready, retry, failed, skipped (дубль), lost, db_unavailable, invalid.",
|
||
"id": 16,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 16,
|
||
"y": 24
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "ops",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (outcome) (rate(messenger_jobs_processed_total[1m]))",
|
||
"legendFormat": "{{outcome}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Обработка задания p50 / p95 / p99 (worker)",
|
||
"description": "Длительность успешной попытки: claim -> S3 -> картинка -> S3 -> COMMIT. Секунды.",
|
||
"id": 17,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 0,
|
||
"y": 32
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"ready\"}[5m])))",
|
||
"legendFormat": "p50"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"ready\"}[5m])))",
|
||
"legendFormat": "p95"
|
||
},
|
||
{
|
||
"refId": "C",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"ready\"}[5m])))",
|
||
"legendFormat": "p99"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Время до ready p50 / p95 / p99",
|
||
"description": "От COMMIT загрузки (202) до COMMIT ready: ожидание в очереди + все попытки. Секунды.",
|
||
"id": 18,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 8,
|
||
"y": 32
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false,
|
||
"thresholdsStyle": {
|
||
"mode": "line+area"
|
||
}
|
||
},
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 30
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[5m])))",
|
||
"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[5m])))",
|
||
"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[5m])))",
|
||
"legendFormat": "p99"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Насыщение worker",
|
||
"description": "Доля занятых слотов worker (WORKER_CONCURRENCY на процесс). 100% долго — не хватает мощности.",
|
||
"id": 19,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 16,
|
||
"y": 32
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "percentunit",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false,
|
||
"thresholdsStyle": {
|
||
"mode": "line+area"
|
||
}
|
||
},
|
||
"min": 0,
|
||
"max": 1,
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 0.9
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(messenger_worker_busy) / sum(messenger_worker_capacity)",
|
||
"legendFormat": "занято / всего"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "row",
|
||
"title": "Ресурсы: пул БД, CPU, память",
|
||
"id": 20,
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 40
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Пул соединений с БД",
|
||
"description": "used/idle/максимум и запросы, ждущие соединение (сумма по репликам). Ожидающие > 0 — пул исчерпан или БД отвечает медленно.",
|
||
"id": 21,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 0,
|
||
"y": 41
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (db_client_connection_pool_name, db_client_connection_state) (db_client_connection_count)",
|
||
"legendFormat": "{{db_client_connection_pool_name}} {{db_client_connection_state}}"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (db_client_connection_pool_name) (db_client_connection_pending_requests)",
|
||
"legendFormat": "{{db_client_connection_pool_name}} ждут соединение"
|
||
},
|
||
{
|
||
"refId": "C",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (db_client_connection_pool_name) (db_client_connection_max)",
|
||
"legendFormat": "{{db_client_connection_pool_name}} максимум"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "CPU процессов (ядер)",
|
||
"description": "Секунды CPU в секунду = занятых ядер. Без дочерних процессов обработки картинок worker.",
|
||
"id": 22,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 8,
|
||
"y": 41
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (job, instance) (rate(process_cpu_time_seconds_total{job=~\"messenger-.*\"}[1m]))",
|
||
"legendFormat": "{{job}} {{instance}}"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "rate(otelcol_process_cpu_seconds_total[1m])",
|
||
"legendFormat": "otel-collector"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Память процессов (RSS)",
|
||
"description": "Резидентная память (RSS). У Collector memory_limiter ограничивает кучу (400 МиБ), лимит контейнера 512 МиБ.",
|
||
"id": 23,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 8,
|
||
"x": 16,
|
||
"y": 41
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "bytes",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "process_memory_usage_bytes{job=~\"messenger-.*\"}",
|
||
"legendFormat": "{{job}} {{instance}}"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "otelcol_process_memory_rss_bytes",
|
||
"legendFormat": "otel-collector RSS"
|
||
},
|
||
{
|
||
"refId": "C",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "otelcol_process_runtime_heap_alloc_bytes",
|
||
"legendFormat": "otel-collector куча"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "row",
|
||
"title": "Конвейер телеметрии (OTel Collector)",
|
||
"id": 24,
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 49
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Принято / отправлено / потеряно (в секунду)",
|
||
"description": "Если хранилище недоступно: отправлено падает до 0, растёт «не отправлено» (после 5 минут повторов) и очередь exporter.",
|
||
"id": 25,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 50
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(otelcol_receiver_accepted_spans_total[1m]))",
|
||
"legendFormat": "spans принято"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(otelcol_exporter_sent_spans_total[1m]))",
|
||
"legendFormat": "spans отправлено"
|
||
},
|
||
{
|
||
"refId": "C",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(otelcol_exporter_send_failed_spans_total[1m]))",
|
||
"legendFormat": "spans не отправлено"
|
||
},
|
||
{
|
||
"refId": "D",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(otelcol_receiver_accepted_log_records_total[1m]))",
|
||
"legendFormat": "логи принято"
|
||
},
|
||
{
|
||
"refId": "E",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(otelcol_exporter_sent_log_records_total[1m]))",
|
||
"legendFormat": "логи отправлено"
|
||
},
|
||
{
|
||
"refId": "F",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(otelcol_exporter_send_failed_log_records_total[1m]))",
|
||
"legendFormat": "логи не отправлено"
|
||
},
|
||
{
|
||
"refId": "G",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(otelcol_exporter_sent_metric_points_total[1m]))",
|
||
"legendFormat": "точки метрик отправлено"
|
||
},
|
||
{
|
||
"refId": "H",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(otelcol_exporter_send_failed_metric_points_total[1m]))",
|
||
"legendFormat": "точки метрик не отправлено"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Очереди exporter (пачки)",
|
||
"description": "Очередь ограничена ёмкостью: при недоступном хранилище она заполняется, но не растёт бесконечно.",
|
||
"id": 26,
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 50
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 2,
|
||
"fillOpacity": 10,
|
||
"showPoints": "never",
|
||
"spanNulls": false
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "table",
|
||
"placement": "bottom",
|
||
"calcs": [
|
||
"lastNotNull",
|
||
"max"
|
||
]
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (exporter) (otelcol_exporter_queue_size)",
|
||
"legendFormat": "{{exporter}} в очереди"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max(otelcol_exporter_queue_capacity)",
|
||
"legendFormat": "ёмкость"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "row",
|
||
"title": "Логи и трассы",
|
||
"id": 27,
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 58
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"type": "logs",
|
||
"title": "Логи API и worker (предупреждения и ошибки)",
|
||
"id": 28,
|
||
"datasource": {
|
||
"type": "loki",
|
||
"uid": "loki"
|
||
},
|
||
"gridPos": {
|
||
"h": 10,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 59
|
||
},
|
||
"description": "Структурные логи: event, severity, trace_id/span_id. Клик по записи -> кнопка Trace открывает трассу в Tempo.",
|
||
"options": {
|
||
"showTime": true,
|
||
"wrapLogMessage": true,
|
||
"enableLogDetails": true,
|
||
"sortOrder": "Descending",
|
||
"dedupStrategy": "none"
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "loki",
|
||
"uid": "loki"
|
||
},
|
||
"expr": "{service_name=~\"messenger-api|messenger-worker\"} | severity_text=~\"WARN.*|ERROR|CRITICAL\"",
|
||
"queryType": "range"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "table",
|
||
"title": "Трассы загрузок (последние)",
|
||
"id": 29,
|
||
"datasource": {
|
||
"type": "tempo",
|
||
"uid": "tempo"
|
||
},
|
||
"gridPos": {
|
||
"h": 10,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 59
|
||
},
|
||
"description": "TraceQL: server span загрузки с attachment_id. Клик по trace ID — вся цепочка upload -> publish -> consume -> S3/DB.",
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "tempo",
|
||
"uid": "tempo"
|
||
},
|
||
"queryType": "traceql",
|
||
"limit": 20,
|
||
"tableType": "traces",
|
||
"query": "{ kind = server && span.messenger.attachment.id != \"\" }"
|
||
}
|
||
]
|
||
}
|
||
],
|
||
"description": "Импортируется автоматически (infra/grafana/provisioning/dashboards). Запросы и единицы — в REPORT.md."
|
||
} |