Files
2026-11-23 14:54:48 +03:00

181 lines
6.3 KiB
JSON

{
"uid": "mtusi-lab6-obs",
"title": "MTUSI Messenger — Lab 6 Observability",
"schemaVersion": 39,
"version": 1,
"refresh": "5s",
"time": { "from": "now-15m", "to": "now" },
"panels": [
{
"id": 1,
"type": "timeseries",
"title": "API Business RPS (by route & status class)",
"gridPos": { "x": 0, "y": 0, "w": 8, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"fieldConfig": { "defaults": { "unit": "reqps" } },
"targets": [
{
"refId": "A",
"expr": "sum by (http_route, http_response_status_class) (rate(http_server_requests_total{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[1m]))",
"legendFormat": "{{http_route}} ({{http_response_status_class}})"
}
]
},
{
"id": 2,
"type": "timeseries",
"title": "API 5xx Error Ratio (%)",
"gridPos": { "x": 8, "y": 0, "w": 8, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"fieldConfig": { "defaults": { "unit": "percent", "min": 0 } },
"targets": [
{
"refId": "A",
"expr": "100 * (sum(rate(http_server_requests_total{service_name=\"messenger-api\",http_route!~\"/health/.*\",http_response_status_class=\"5xx\"}[1m])) or vector(0)) / clamp_min(sum(rate(http_server_requests_total{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[1m])), 1e-9)",
"legendFormat": "5xx error %"
}
]
},
{
"id": 3,
"type": "timeseries",
"title": "API Duration p50 / p95 / p99 (aggregated histogram)",
"gridPos": { "x": 16, "y": 0, "w": 8, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"fieldConfig": { "defaults": { "unit": "s" } },
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.50, sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[1m])))",
"legendFormat": "p50"
},
{
"refId": "B",
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[1m])))",
"legendFormat": "p95"
},
{
"refId": "C",
"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[1m])))",
"legendFormat": "p99"
}
]
},
{
"id": 4,
"type": "timeseries",
"title": "Worker Jobs Throughput (by outcome)",
"gridPos": { "x": 0, "y": 8, "w": 8, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"fieldConfig": { "defaults": { "unit": "ops" } },
"targets": [
{
"refId": "A",
"expr": "sum by (outcome) (rate(worker_jobs_total[1m]))",
"legendFormat": "{{outcome}}"
}
]
},
{
"id": 5,
"type": "timeseries",
"title": "Job Processing & End-to-End Time to Ready (p50 / p95)",
"gridPos": { "x": 8, "y": 8, "w": 8, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"fieldConfig": { "defaults": { "unit": "s" } },
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.50, sum by (le) (rate(worker_job_duration_seconds_bucket[1m])))",
"legendFormat": "job p50"
},
{
"refId": "B",
"expr": "histogram_quantile(0.95, sum by (le) (rate(worker_job_duration_seconds_bucket[1m])))",
"legendFormat": "job p95"
},
{
"refId": "C",
"expr": "histogram_quantile(0.95, sum by (le) (rate(attachment_time_to_ready_seconds_bucket[1m])))",
"legendFormat": "e2e ready p95"
}
]
},
{
"id": 6,
"type": "timeseries",
"title": "Queue Depth & Oldest Unfinished Job Age",
"gridPos": { "x": 16, "y": 8, "w": 8, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{
"refId": "A",
"expr": "max by (state) (worker_queue_depth{queue_name=\"attachment-jobs\"})",
"legendFormat": "depth {{state}}"
},
{
"refId": "B",
"expr": "max(worker_oldest_job_age_seconds{queue_name=\"attachment-jobs\"})",
"legendFormat": "oldest age (s)"
}
]
},
{
"id": 7,
"type": "timeseries",
"title": "DB Pool Saturation (used / idle / waiting)",
"gridPos": { "x": 0, "y": 16, "w": 8, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{
"refId": "A",
"expr": "sum by (state) (db_pool_connections)",
"legendFormat": "pool {{state}}"
}
]
},
{
"id": 8,
"type": "timeseries",
"title": "Worker Concurrency Saturation & Process RSS",
"gridPos": { "x": 8, "y": 16, "w": 8, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{
"refId": "A",
"expr": "max by (state) (worker_threads)",
"legendFormat": "worker {{state}}"
},
{
"refId": "B",
"expr": "avg by (service_name) (process_memory_rss_bytes) / 1048576",
"legendFormat": "RSS MiB {{service_name}}"
}
]
},
{
"id": 9,
"type": "timeseries",
"title": "OTel Collector Pipeline (accepted / sent / failed)",
"gridPos": { "x": 16, "y": 16, "w": 8, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{
"refId": "A",
"expr": "sum(rate(otelcol_receiver_accepted_spans_total[1m])) or sum(rate(otelcol_receiver_accepted_spans[1m]))",
"legendFormat": "spans accepted/s"
},
{
"refId": "B",
"expr": "sum(rate(otelcol_exporter_sent_spans_total[1m])) or sum(rate(otelcol_exporter_sent_spans[1m]))",
"legendFormat": "spans sent/s"
},
{
"refId": "C",
"expr": "sum(rate(otelcol_exporter_send_failed_spans_total[1m])) or sum(rate(otelcol_exporter_send_failed_spans[1m]))",
"legendFormat": "spans send_failed/s"
}
]
}
]
}