forked from mtusi2026/mtusi2026lab6
1295 lines
32 KiB
JSON
1295 lines
32 KiB
JSON
{
|
||
"uid": "messenger-overview",
|
||
"title": "Messenger: API и worker",
|
||
"schemaVersion": 39,
|
||
"version": 1,
|
||
"editable": false,
|
||
"refresh": "10s",
|
||
"time": {
|
||
"from": "now-15m",
|
||
"to": "now"
|
||
},
|
||
"timezone": "utc",
|
||
"tags": [
|
||
"messenger",
|
||
"lab6"
|
||
],
|
||
"templating": {
|
||
"list": []
|
||
},
|
||
"annotations": {
|
||
"list": []
|
||
},
|
||
"panels": [
|
||
{
|
||
"type": "row",
|
||
"title": "API (бизнес-запросы; /health* и /internal/* исключены)",
|
||
"collapsed": false,
|
||
"id": 1,
|
||
"panels": [],
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 0
|
||
}
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "RPS по маршруту и классу статуса",
|
||
"id": 2,
|
||
"description": "rate(http_server_request_duration_seconds_count[1m]) по http_route и классу кода; число запросов — _count гистограммы.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 1
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "reqps",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (http_route, status_class)(label_replace(rate(http_server_request_duration_seconds_count{job=\"messenger-api\",http_route!~\"/health.*|/internal/.*\"}[1m]), \"status_class\", \"${1}xx\", \"http_response_status_code\", \"(.)..\"))",
|
||
"legendFormat": "{{http_route}} {{status_class}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Доля 5xx (1m)",
|
||
"id": 3,
|
||
"description": "Recording rules: 5xx rate / все бизнес-запросы за 1m; 4xx — не ошибка сервиса. Пусто без трафика (N/A).",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 1
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "percentunit",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
},
|
||
"min": 0,
|
||
"max": 1
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "messenger:api_errors:rate1m / messenger:api_requests:rate1m",
|
||
"legendFormat": "5xx / бизнес-запросы"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "stat",
|
||
"title": "Availability (5m), цель ≥ 99.5%",
|
||
"id": 4,
|
||
"description": "1 - 5xx/все бизнес-запросы за 5m (recording rule messenger:api_availability:ratio5m). N/A без трафика.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 4,
|
||
"w": 6,
|
||
"x": 0,
|
||
"y": 9
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "percentunit"
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
]
|
||
},
|
||
"colorMode": "value"
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "messenger:api_availability:ratio5m",
|
||
"legendFormat": ""
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "stat",
|
||
"title": "Свежие реплики API",
|
||
"id": 5,
|
||
"description": "Число API-реплик, чей target_info обновлялся за последние 30 с (OTLP-метрики).",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 4,
|
||
"w": 6,
|
||
"x": 6,
|
||
"y": 9
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short"
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
]
|
||
},
|
||
"colorMode": "value"
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "count((time() - timestamp(target_info{job=\"messenger-api\"})) < 30) or vector(0)",
|
||
"legendFormat": ""
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "stat",
|
||
"title": "HAProxy 5xx, rps",
|
||
"id": 6,
|
||
"description": "HAProxy backend api: ответы 5xx (включая 503 балансировщика, когда нет готовых узлов).",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 4,
|
||
"w": 6,
|
||
"x": 12,
|
||
"y": 9
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "reqps"
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
]
|
||
},
|
||
"colorMode": "value"
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rate(haproxy_backend_http_responses_total{proxy=\"api\",code=\"5xx\"}[1m])) or vector(0)",
|
||
"legendFormat": ""
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "stat",
|
||
"title": "HAProxy: активные серверы",
|
||
"id": 7,
|
||
"description": "Активные серверы backend api по данным HAProxy PROMEX.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 4,
|
||
"w": 6,
|
||
"x": 18,
|
||
"y": 9
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short"
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
]
|
||
},
|
||
"colorMode": "value"
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "haproxy_backend_active_servers{proxy=\"api\"}",
|
||
"legendFormat": ""
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Задержка HTTP: общая p50/p95/p99",
|
||
"id": 8,
|
||
"description": "histogram_quantile по суммированным бакетам всех реплик; перцентили реплик не усредняются.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 13
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"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\",http_route!~\"/health.*|/internal/.*\"}[1m])))",
|
||
"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\",http_route!~\"/health.*|/internal/.*\"}[1m])))",
|
||
"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\",http_route!~\"/health.*|/internal/.*\"}[1m])))",
|
||
"legendFormat": "p99"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Задержка HTTP по маршруту p50/p95/p99",
|
||
"id": 9,
|
||
"description": "То же, с разбивкой по route template.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 13
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.5, sum by(le,http_route)(rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\",http_route!~\"/health.*|/internal/.*\"}[1m])))",
|
||
"legendFormat": "p50 {{http_route}}"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"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.*|/internal/.*\"}[1m])))",
|
||
"legendFormat": "p95 {{http_route}}"
|
||
},
|
||
{
|
||
"refId": "C",
|
||
"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\",http_route!~\"/health.*|/internal/.*\"}[1m])))",
|
||
"legendFormat": "p99 {{http_route}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "row",
|
||
"title": "Worker и задачи",
|
||
"collapsed": false,
|
||
"id": 10,
|
||
"panels": [],
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 21
|
||
}
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Задачи по outcome",
|
||
"id": 11,
|
||
"description": "messenger_jobs_processed_total по фактическому outcome (succeeded, retry, failed, ...), задач/с.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 22
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "ops",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"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",
|
||
"id": 12,
|
||
"description": "От claim до commit одной попытки; не включает ожидание в очереди.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 22
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.5, sum by(le)(rate(messenger_job_duration_seconds_bucket[1m])))",
|
||
"legendFormat": "p50"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.95, sum by(le)(rate(messenger_job_duration_seconds_bucket[1m])))",
|
||
"legendFormat": "p95"
|
||
},
|
||
{
|
||
"refId": "C",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.99, sum by(le)(rate(messenger_job_duration_seconds_bucket[1m])))",
|
||
"legendFormat": "p99"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Time-to-ready p50/p95/p99",
|
||
"id": 13,
|
||
"description": "От durable acceptance (created_at задачи) до commit ready; включает очередь, ретраи и backoff. Измеряется на commit, до ACK и cleanup.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 30
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.5, sum by(le)(rate(messenger_attachment_time_to_ready_seconds_bucket[1m])))",
|
||
"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[1m])))",
|
||
"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[1m])))",
|
||
"legendFormat": "p99"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Worker: занято / ёмкость",
|
||
"id": 14,
|
||
"description": "Задач в работе против WORKER_CONCURRENCY; показатели не суммируются.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 30
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(messenger_worker_jobs_active)",
|
||
"legendFormat": "active"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max(messenger_worker_jobs_capacity)",
|
||
"legendFormat": "capacity (WORKER_CONCURRENCY)"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "row",
|
||
"title": "Очередь и outbox (snapshot PostgreSQL, max по репликам)",
|
||
"collapsed": false,
|
||
"id": 15,
|
||
"panels": [],
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 38
|
||
}
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Глубина очереди по состоянию",
|
||
"id": 16,
|
||
"description": "Незавершённые задачи по state; обе реплики публикуют одно значение, поэтому max, а не sum.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 39
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max by (state)(messenger_jobs_queue_depth)",
|
||
"legendFormat": "{{state}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Возраст самой старой задачи",
|
||
"id": 17,
|
||
"description": "Возраст ожидания backlog (alert MessengerJobsQueueLagGrowing: > 30 с), не время обработки.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 39
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max(messenger_jobs_queue_oldest_age_seconds)",
|
||
"legendFormat": "oldest job age"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Outbox: ожидающие и возраст",
|
||
"id": 18,
|
||
"description": "Неопубликованные записи outbox (доступные к публикации) и возраст старейшей.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 47
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max(messenger_outbox_pending)",
|
||
"legendFormat": "pending (шт.)"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max(messenger_outbox_oldest_age_seconds)",
|
||
"legendFormat": "oldest age (с)"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "RabbitMQ: ready / unacked",
|
||
"id": 19,
|
||
"description": "Агрегат по очередям, rabbitmq_prometheus (порт 15692, внутри сети).",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 47
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rabbitmq_queue_messages_ready)",
|
||
"legendFormat": "ready"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum(rabbitmq_queue_messages_unacked)",
|
||
"legendFormat": "unacked"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "row",
|
||
"title": "PostgreSQL и процессы",
|
||
"collapsed": false,
|
||
"id": 20,
|
||
"panels": [],
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 55
|
||
}
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Пул БД: used / idle / max",
|
||
"id": 21,
|
||
"description": "Соединения основного пула по репликам.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 56
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (db_client_connection_state, instance)(db_client_connection_count{job=~\"messenger-.*\",db_client_connection_pool_name=\"main\"})",
|
||
"legendFormat": "{{db_client_connection_state}} {{instance}}"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "max by (instance)(db_client_connection_max{job=~\"messenger-.*\",db_client_connection_pool_name=\"main\"})",
|
||
"legendFormat": "max {{instance}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Пул БД: ожидающие запросы и wait p95",
|
||
"id": 22,
|
||
"description": "Очередь на получение соединения и p95 ожидания (секунды).",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 56
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "sum by (instance)(db_client_connection_pending_requests{job=~\"messenger-.*\"})",
|
||
"legendFormat": "pending {{instance}}"
|
||
},
|
||
{
|
||
"refId": "B",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.95, sum by (le)(rate(db_client_connection_wait_time_seconds_bucket{job=~\"messenger-.*\"}[1m])))",
|
||
"legendFormat": "wait p95 (с)"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Операция БД p95 по db_operation_name",
|
||
"id": 23,
|
||
"description": "p95 длительности операций БД по типу операции.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 64
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "histogram_quantile(0.95, sum by (le, db_operation_name)(rate(db_client_operation_duration_seconds_bucket{job=~\"messenger-.*\"}[1m])))",
|
||
"legendFormat": "{{db_operation_name}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "CPU процессов (ядра)",
|
||
"id": 24,
|
||
"description": "rate(process_cpu_time_seconds_total): 1.0 = одно логическое ядро.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 64
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"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}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "RAM процессов",
|
||
"id": 25,
|
||
"description": "Resident memory процесса и использованная куча V8.",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 72
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "bytes",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"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": "v8js_memory_heap_used_bytes{job=~\"messenger-.*\"}",
|
||
"legendFormat": "heap {{job}} {{instance}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "timeseries",
|
||
"title": "Event loop delay p99",
|
||
"id": 26,
|
||
"description": "Задержка event loop (p99 окна, секунды).",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"gridPos": {
|
||
"h": 8,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 72
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"custom": {
|
||
"lineWidth": 1,
|
||
"fillOpacity": 8,
|
||
"showPoints": "never"
|
||
}
|
||
},
|
||
"overrides": []
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "prometheus",
|
||
"uid": "prometheus"
|
||
},
|
||
"expr": "nodejs_eventloop_delay_p99_seconds{job=~\"messenger-.*\"}",
|
||
"legendFormat": "{{job}} {{instance}}"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "row",
|
||
"title": "Логи (переход в трассу по TraceID)",
|
||
"collapsed": false,
|
||
"id": 27,
|
||
"panels": [],
|
||
"gridPos": {
|
||
"h": 1,
|
||
"w": 24,
|
||
"x": 0,
|
||
"y": 80
|
||
}
|
||
},
|
||
{
|
||
"type": "logs",
|
||
"title": "Логи API",
|
||
"id": 28,
|
||
"description": "Структурные логи; trace_id — structured metadata, поле TraceID ведёт в Tempo.",
|
||
"datasource": {
|
||
"type": "loki",
|
||
"uid": "loki"
|
||
},
|
||
"gridPos": {
|
||
"h": 10,
|
||
"w": 12,
|
||
"x": 0,
|
||
"y": 81
|
||
},
|
||
"options": {
|
||
"showTime": true,
|
||
"wrapLogMessage": true,
|
||
"sortOrder": "Descending",
|
||
"enableLogDetails": true
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "loki",
|
||
"uid": "loki"
|
||
},
|
||
"expr": "{service_name=\"messenger-api\"}",
|
||
"queryType": "range"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"type": "logs",
|
||
"title": "Логи worker",
|
||
"id": 29,
|
||
"description": "Структурные логи worker; trace_id ведёт в Tempo.",
|
||
"datasource": {
|
||
"type": "loki",
|
||
"uid": "loki"
|
||
},
|
||
"gridPos": {
|
||
"h": 10,
|
||
"w": 12,
|
||
"x": 12,
|
||
"y": 81
|
||
},
|
||
"options": {
|
||
"showTime": true,
|
||
"wrapLogMessage": true,
|
||
"sortOrder": "Descending",
|
||
"enableLogDetails": true
|
||
},
|
||
"targets": [
|
||
{
|
||
"refId": "A",
|
||
"datasource": {
|
||
"type": "loki",
|
||
"uid": "loki"
|
||
},
|
||
"expr": "{service_name=\"messenger-worker\"}",
|
||
"queryType": "range"
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|