forked from mtusi2026/mtusi2026lab6
API и worker отдают метрики, логи и трассы. Правила SLO записаны, прогон инцидентов ещё впереди.
157 lines
6.8 KiB
JSON
157 lines
6.8 KiB
JSON
{
|
|
"uid": "messenger-lab6",
|
|
"title": "Messenger observability",
|
|
"tags": ["messenger", "lab6"],
|
|
"timezone": "browser",
|
|
"schemaVersion": 39,
|
|
"version": 1,
|
|
"refresh": "10s",
|
|
"time": {"from": "now-1h", "to": "now"},
|
|
"description": "RPS and errors use messenger_http_requests_total. Durations are histogram_quantile over buckets, in seconds. Queue age is seconds. API error ratio excludes health.",
|
|
"panels": [
|
|
{
|
|
"id": 1,
|
|
"type": "timeseries",
|
|
"title": "API RPS",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 0},
|
|
"fieldConfig": {"defaults": {"unit": "reqps", "custom": {"drawStyle": "line"}}, "overrides": []},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"expr": "sum by (method, route) (rate(messenger_http_requests_total[1m]))",
|
|
"legendFormat": "{{method}} {{route}}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 2,
|
|
"type": "timeseries",
|
|
"title": "API error ratio (5xx / business)",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 0},
|
|
"fieldConfig": {"defaults": {"unit": "percentunit", "min": 0, "max": 1}, "overrides": []},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"expr": "sum(rate(messenger_http_requests_total{status_class=\"5xx\"}[1m])) / clamp_min(sum(rate(messenger_http_requests_total[1m])), 1e-9)",
|
|
"legendFormat": "5xx ratio"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 3,
|
|
"type": "timeseries",
|
|
"title": "API duration p50 / p95 / p99",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 8},
|
|
"fieldConfig": {"defaults": {"unit": "s"}, "overrides": []},
|
|
"targets": [
|
|
{"refId": "A", "expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_http_request_duration_seconds_bucket[1m])))", "legendFormat": "p50"},
|
|
{"refId": "B", "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_http_request_duration_seconds_bucket[1m])))", "legendFormat": "p95"},
|
|
{"refId": "C", "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_http_request_duration_seconds_bucket[1m])))", "legendFormat": "p99"}
|
|
]
|
|
},
|
|
{
|
|
"id": 4,
|
|
"type": "timeseries",
|
|
"title": "Jobs by outcome",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 8},
|
|
"fieldConfig": {"defaults": {"unit": "ops"}, "overrides": []},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"expr": "sum by (outcome) (rate(messenger_jobs_total[1m]))",
|
|
"legendFormat": "{{outcome}}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 5,
|
|
"type": "timeseries",
|
|
"title": "Worker duration p50 / p95 / p99",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 16},
|
|
"fieldConfig": {"defaults": {"unit": "s"}, "overrides": []},
|
|
"targets": [
|
|
{"refId": "A", "expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_job_duration_seconds_bucket[1m])))", "legendFormat": "p50"},
|
|
{"refId": "B", "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket[1m])))", "legendFormat": "p95"},
|
|
{"refId": "C", "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_duration_seconds_bucket[1m])))", "legendFormat": "p99"}
|
|
]
|
|
},
|
|
{
|
|
"id": 6,
|
|
"type": "timeseries",
|
|
"title": "Time to ready p50 / p95 / p99",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 16},
|
|
"fieldConfig": {"defaults": {"unit": "s"}, "overrides": []},
|
|
"targets": [
|
|
{"refId": "A", "expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_time_to_ready_seconds_bucket[1m])))", "legendFormat": "p50"},
|
|
{"refId": "B", "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_time_to_ready_seconds_bucket[1m])))", "legendFormat": "p95"},
|
|
{"refId": "C", "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_time_to_ready_seconds_bucket[1m])))", "legendFormat": "p99"}
|
|
]
|
|
},
|
|
{
|
|
"id": 7,
|
|
"type": "timeseries",
|
|
"title": "Queue depth and oldest job age",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 24},
|
|
"fieldConfig": {"defaults": {}, "overrides": []},
|
|
"targets": [
|
|
{"refId": "A", "expr": "max(messenger_queue_depth)", "legendFormat": "depth (jobs)"},
|
|
{"refId": "B", "expr": "max(messenger_queue_oldest_age_seconds)", "legendFormat": "oldest age (seconds)"}
|
|
]
|
|
},
|
|
{
|
|
"id": 8,
|
|
"type": "timeseries",
|
|
"title": "DB pool used and waiting",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 24},
|
|
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
|
|
"targets": [
|
|
{"refId": "A", "expr": "max by (service_name, service_instance_id) (messenger_db_pool_used)", "legendFormat": "used {{service_name}} {{service_instance_id}}"},
|
|
{"refId": "B", "expr": "max by (service_name, service_instance_id) (messenger_db_pool_waiting)", "legendFormat": "waiting {{service_name}} {{service_instance_id}}"}
|
|
]
|
|
},
|
|
{
|
|
"id": 9,
|
|
"type": "timeseries",
|
|
"title": "Worker busy / capacity",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 32},
|
|
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
|
|
"targets": [
|
|
{"refId": "A", "expr": "max(messenger_worker_busy)", "legendFormat": "busy"},
|
|
{"refId": "B", "expr": "max(messenger_worker_capacity)", "legendFormat": "capacity"}
|
|
]
|
|
},
|
|
{
|
|
"id": 10,
|
|
"type": "timeseries",
|
|
"title": "Process CPU and RSS",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 32},
|
|
"fieldConfig": {"defaults": {}, "overrides": []},
|
|
"targets": [
|
|
{"refId": "A", "expr": "max by (service_name, service_instance_id) (process_cpu_percent)", "legendFormat": "cpu % {{service_name}} {{service_instance_id}}"},
|
|
{"refId": "B", "expr": "max by (service_name, service_instance_id) (process_memory_rss_bytes)", "legendFormat": "rss {{service_name}} {{service_instance_id}}"}
|
|
]
|
|
},
|
|
{
|
|
"id": 11,
|
|
"type": "timeseries",
|
|
"title": "Firing alerts",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 24, "x": 0, "y": 40},
|
|
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
|
|
"targets": [
|
|
{"refId": "A", "expr": "ALERTS{alertstate=\"firing\"}", "legendFormat": "{{alertname}}"}
|
|
]
|
|
}
|
|
]
|
|
}
|