107 lines
5.1 KiB
JSON
107 lines
5.1 KiB
JSON
{
|
|
"annotations": {"list": []},
|
|
"editable": true,
|
|
"graphTooltip": 1,
|
|
"title": "Messenger — API, worker, queue",
|
|
"uid": "messenger-lab6",
|
|
"schemaVersion": 39,
|
|
"version": 1,
|
|
"time": {"from": "now-30m", "to": "now"},
|
|
"refresh": "10s",
|
|
"templating": {"list": []},
|
|
"panels": [
|
|
{
|
|
"id": 1, "type": "timeseries", "title": "API RPS by route",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 0},
|
|
"fieldConfig": {"defaults": {"unit": "reqps"}, "overrides": []},
|
|
"targets": [{"expr": "sum by (route) (rate(http_server_requests_total[1m]))", "legendFormat": "{{route}}"}]
|
|
},
|
|
{
|
|
"id": 2, "type": "timeseries", "title": "API 5xx error ratio (business routes)",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 0},
|
|
"fieldConfig": {"defaults": {"unit": "percentunit"}, "overrides": []},
|
|
"targets": [{"expr": "sum(rate(http_server_requests_total{status_class=\"5xx\",route!~\".*health.*\"}[5m])) / clamp_min(sum(rate(http_server_requests_total{route!~\".*health.*\"}[5m])), 1)", "legendFormat": "5xx ratio"}]
|
|
},
|
|
{
|
|
"id": 3, "type": "timeseries", "title": "API latency p50/p95/p99 (histogram, ms)",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 8},
|
|
"fieldConfig": {"defaults": {"unit": "ms"}, "overrides": []},
|
|
"targets": [
|
|
{"expr": "histogram_quantile(0.50, sum by (le) (rate(http_server_duration_milliseconds_bucket[5m])))", "legendFormat": "p50"},
|
|
{"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_duration_milliseconds_bucket[5m])))", "legendFormat": "p95"},
|
|
{"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_duration_milliseconds_bucket[5m])))", "legendFormat": "p99"}
|
|
]
|
|
},
|
|
{
|
|
"id": 4, "type": "timeseries", "title": "Jobs processed/s by outcome",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 8},
|
|
"fieldConfig": {"defaults": {"unit": "ops"}, "overrides": []},
|
|
"targets": [{"expr": "sum by (outcome) (rate(messenger_jobs_processed_total[5m]))", "legendFormat": "{{outcome}}"}]
|
|
},
|
|
{
|
|
"id": 5, "type": "timeseries", "title": "Job duration p95 / time-to-ready p95 (histogram)",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 16},
|
|
"fieldConfig": {"defaults": {"unit": "s"}, "overrides": []},
|
|
"targets": [
|
|
{"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_jobs_duration_bucket[5m])))", "legendFormat": "job p95"},
|
|
{"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_attachment_time_to_ready_bucket[5m])))", "legendFormat": "time-to-ready p95"}
|
|
]
|
|
},
|
|
{
|
|
"id": 6, "type": "timeseries", "title": "Queue depth / oldest job age",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 16},
|
|
"fieldConfig": {"defaults": {}, "overrides": []},
|
|
"targets": [
|
|
{"expr": "max(messenger_queue_depth)", "legendFormat": "depth"},
|
|
{"expr": "max(messenger_queue_oldest_job_age_seconds)", "legendFormat": "oldest age (s)"}
|
|
]
|
|
},
|
|
{
|
|
"id": 7, "type": "timeseries", "title": "DB pool used / waiting",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 24},
|
|
"fieldConfig": {"defaults": {}, "overrides": []},
|
|
"targets": [
|
|
{"expr": "max(messenger_db_pool_used)", "legendFormat": "used"},
|
|
{"expr": "max(messenger_db_pool_waiting)", "legendFormat": "waiting"}
|
|
]
|
|
},
|
|
{
|
|
"id": 8, "type": "timeseries", "title": "Worker busy / capacity",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 24},
|
|
"fieldConfig": {"defaults": {}, "overrides": []},
|
|
"targets": [
|
|
{"expr": "sum(messenger_worker_busy)", "legendFormat": "busy"},
|
|
{"expr": "sum(messenger_worker_capacity)", "legendFormat": "capacity"}
|
|
]
|
|
},
|
|
{
|
|
"id": 9, "type": "timeseries", "title": "Process memory (API + worker)",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 32},
|
|
"fieldConfig": {"defaults": {"unit": "bytes"}, "overrides": []},
|
|
"targets": [{"expr": "sum by (service_name) (process_memory_usage_bytes)", "legendFormat": "{{service_name}}"}]
|
|
},
|
|
{
|
|
"id": 10, "type": "logs", "title": "API logs (Loki) — JSON with trace_id",
|
|
"datasource": {"type": "loki", "uid": "loki"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 32},
|
|
"options": {"showTime": true, "wrapLogMessage": true},
|
|
"targets": [{"expr": "{service_name=\"messenger-api\"} | json"}]
|
|
},
|
|
{
|
|
"id": 11, "type": "traces", "title": "Traces (Tempo)",
|
|
"datasource": {"type": "tempo", "uid": "tempo"},
|
|
"gridPos": {"h": 8, "w": 24, "x": 0, "y": 40},
|
|
"targets": [{"query": "{}", "queryType": "traceql"}]
|
|
}
|
|
]
|
|
}
|