Files
mtusi2026lab6/infra/grafana/dashboards/messenger-observability.json
T

184 lines
9.8 KiB
JSON

{
"annotations": {"list": []},
"editable": false,
"fiscalYearStartMonth": 0,
"graphTooltip": 1,
"id": null,
"links": [],
"panels": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"description": "Business requests per second; health routes are excluded.",
"fieldConfig": {"defaults": {"unit": "reqps"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 0},
"id": 1,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [{"expr": "sum by (http_route, http_request_method) (rate(http_server_request_count_total{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[$__rate_interval]))", "legendFormat": "{{http_request_method}} {{http_route}}", "refId": "A"}],
"title": "API RPS",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"description": "5xx business requests divided by all business requests over 2 minutes.",
"fieldConfig": {"defaults": {"max": 1, "min": 0, "unit": "percentunit"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 0},
"id": 2,
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "single"}},
"targets": [{"expr": "(sum(rate(http_server_request_count_total{service_name=\"messenger-api\",http_route!~\"/health/.*\",http_response_status_class=\"5xx\"}[2m])) / clamp_min(sum(rate(http_server_request_count_total{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[2m])), 0.001)) or vector(0)", "legendFormat": "5xx ratio", "refId": "A"}],
"title": "API server error ratio",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"description": "Percentiles are computed from aggregate histogram buckets across API replicas.",
"fieldConfig": {"defaults": {"unit": "s"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 0},
"id": 3,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [
{"expr": "histogram_quantile(0.50, sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[5m])))", "legendFormat": "p50", "refId": "A"},
{"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[5m])))", "legendFormat": "p95", "refId": "B"},
{"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name=\"messenger-api\",http_route!~\"/health/.*\"}[5m])))", "legendFormat": "p99", "refId": "C"}
],
"title": "API duration p50 / p95 / p99",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "ops"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 8},
"id": 4,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [{"expr": "sum by (outcome) (rate(messenger_jobs_processed_total[$__rate_interval]))", "legendFormat": "{{outcome}}", "refId": "A"}],
"title": "Jobs by outcome",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "s"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 8},
"id": 5,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [
{"expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket[5m])))", "legendFormat": "p50", "refId": "A"},
{"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket[5m])))", "legendFormat": "p95", "refId": "B"},
{"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket[5m])))", "legendFormat": "p99", "refId": "C"}
],
"title": "Worker duration p50 / p95 / p99",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"description": "Time from durable acceptance to ready commit.",
"fieldConfig": {"defaults": {"unit": "s"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 8},
"id": 6,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [
{"expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[5m])))", "legendFormat": "p50", "refId": "A"},
{"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[5m])))", "legendFormat": "p95", "refId": "B"},
{"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[5m])))", "legendFormat": "p99", "refId": "C"}
],
"title": "End-to-end time to ready",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"description": "Logical non-terminal jobs from PostgreSQL and age of the oldest one.",
"fieldConfig": {"defaults": {}, "overrides": [{"matcher": {"id": "byName", "options": "oldest age"}, "properties": [{"id": "unit", "value": "s"}]}]},
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 16},
"id": 7,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [
{"expr": "max(messenger_queue_depth{messaging_destination_name=\"attachments.process\"})", "legendFormat": "depth", "refId": "A"},
{"expr": "max(messenger_queue_oldest_age_seconds{messaging_destination_name=\"attachments.process\"})", "legendFormat": "oldest age", "refId": "B"}
],
"title": "Queue depth and oldest job",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "short"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 16},
"id": 8,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [
{"expr": "messenger_db_pool_used", "legendFormat": "used {{service_name}} {{service_instance_id}}", "refId": "A"},
{"expr": "messenger_db_pool_waiting", "legendFormat": "waiting {{service_name}} {{service_instance_id}}", "refId": "B"}
],
"title": "PostgreSQL pool used / waiting",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"max": 1, "min": 0, "unit": "percentunit"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 16},
"id": 9,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [{"expr": "max(messenger_worker_busy) / clamp_min(max(messenger_worker_capacity), 1)", "legendFormat": "saturation", "refId": "A"}],
"title": "Worker saturation",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "percentunit"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 24},
"id": 10,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [{"expr": "rate(process_cpu_time_seconds_total[5m])", "legendFormat": "{{service_name}} {{service_instance_id}}", "refId": "A"}],
"title": "Process CPU",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "bytes"}, "overrides": []},
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 24},
"id": 11,
"options": {"legend": {"displayMode": "table", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
"targets": [{"expr": "process_memory_rss_bytes", "legendFormat": "{{service_name}} {{service_instance_id}}", "refId": "A"}],
"title": "Process RSS",
"type": "timeseries"
},
{
"datasource": {"type": "loki", "uid": "loki"},
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 24},
"id": 12,
"options": {"dedupStrategy": "none", "enableLogDetails": true, "prettifyLogMessage": false, "showCommonLabels": false, "showLabels": false, "showTime": true, "sortOrder": "Descending", "wrapLogMessage": true},
"targets": [{"expr": "{service_name=~\"$service\"} | json | http_route!~\"/health/.*\" | line_format \"{{.severity}} {{.service_name}} {{.event}}{{if .http_method}} {{.http_method}} {{.http_route}} status={{.http_status_code}} duration={{.duration_seconds}}{{end}} trace_id={{.trace_id}} {{.message}}\"", "refId": "A"}],
"title": "Correlated application logs",
"type": "logs"
}
],
"refresh": "5s",
"schemaVersion": 39,
"tags": ["mtusi", "lab6", "opentelemetry"],
"templating": {
"list": [
{
"current": {"selected": false, "text": ".*", "value": ".*"},
"datasource": {"type": "loki", "uid": "loki"},
"definition": "label_values(service_name)",
"hide": 0,
"includeAll": true,
"label": "Service",
"multi": true,
"name": "service",
"options": [],
"query": "label_values(service_name)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
}
]
},
"time": {"from": "now-30m", "to": "now"},
"timepicker": {},
"timezone": "browser",
"title": "Messenger Observability",
"uid": "messenger-observability",
"version": 1,
"weekStart": ""
}