Files
mtusi2026lab6/infra/otel/grafana/dashboards/messenger.json
T

806 lines
19 KiB
JSON

{
"uid": "lab6-messenger",
"title": "Lab6 | Messenger observability",
"schemaVersion": 39,
"version": 1,
"editable": false,
"timezone": "browser",
"refresh": "5s",
"time": {
"from": "now-15m",
"to": "now"
},
"tags": [
"lab6",
"otel"
],
"panels": [
{
"id": 1,
"type": "timeseries",
"title": "Business API throughput",
"description": "Excludes health, counts completed responses.",
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "reqps"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "sum(rate(lab_http_requests_total{route=~\"/api/.*\"}[30s]))",
"legendFormat": "all",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "B",
"expr": "sum(rate(lab_http_requests_total{route=~\"/api/.*\",status_class=\"5xx\"}[30s])) or vector(0)",
"legendFormat": "5xx",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 2,
"type": "timeseries",
"title": "Business API error ratio (5xx)",
"description": "5xx / all business HTTP responses; threshold 5%.",
"gridPos": {
"x": 12,
"y": 0,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "(sum(rate(lab_http_requests_total{route=~\"/api/.*\",status_class=\"5xx\"}[30s])) or vector(0)) / clamp_min(sum(rate(lab_http_requests_total{route=~\"/api/.*\"}[30s])),0.001)",
"legendFormat": "5xx / all",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 3,
"type": "timeseries",
"title": "API latency p50/p95/p99",
"description": "Aggregated histogram buckets across API replicas; seconds, time to response headers.",
"gridPos": {
"x": 0,
"y": 8,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.5, sum(rate(lab_http_duration_seconds_bucket{route=~\"/api/.*\"}[30s])) by (le))",
"legendFormat": "p50",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "B",
"expr": "histogram_quantile(0.95, sum(rate(lab_http_duration_seconds_bucket{route=~\"/api/.*\"}[30s])) by (le))",
"legendFormat": "p95",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "C",
"expr": "histogram_quantile(0.99, sum(rate(lab_http_duration_seconds_bucket{route=~\"/api/.*\"}[30s])) by (le))",
"legendFormat": "p99",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 4,
"type": "timeseries",
"title": "Jobs per second by outcome",
"description": "Attempt outcomes: ready, retry, failed, stale, requeue; not exactly-once audit counts.",
"gridPos": {
"x": 12,
"y": 8,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "ops"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "sum by(outcome)(rate(lab_jobs_total[30s]))",
"legendFormat": "{{outcome}}",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 5,
"type": "timeseries",
"title": "Worker processing duration",
"description": "",
"gridPos": {
"x": 0,
"y": 16,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.5, sum(rate(lab_job_duration_seconds_bucket[30s])) by (le))",
"legendFormat": "p50",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "B",
"expr": "histogram_quantile(0.95, sum(rate(lab_job_duration_seconds_bucket[30s])) by (le))",
"legendFormat": "p95",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "C",
"expr": "histogram_quantile(0.99, sum(rate(lab_job_duration_seconds_bucket[30s])) by (le))",
"legendFormat": "p99",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 6,
"type": "timeseries",
"title": "Time to ready",
"description": "Acceptance to durable ready (includes queue, retry and processing).",
"gridPos": {
"x": 12,
"y": 16,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.5, sum(rate(lab_ready_duration_seconds_bucket[30s])) by (le))",
"legendFormat": "p50",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "B",
"expr": "histogram_quantile(0.95, sum(rate(lab_ready_duration_seconds_bucket[30s])) by (le))",
"legendFormat": "p95",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "C",
"expr": "histogram_quantile(0.99, sum(rate(lab_ready_duration_seconds_bucket[30s])) by (le))",
"legendFormat": "p99",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 7,
"type": "timeseries",
"title": "Queue depth: durable backlog / RabbitMQ ready",
"description": "DB queued includes delayed/unpublished tasks; RabbitMQ ready counts published messages waiting for delivery; neither includes busy jobs.",
"gridPos": {
"x": 0,
"y": 24,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "max(lab_queue_depth)",
"legendFormat": "DB queued",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "B",
"expr": "max(lab_broker_ready)",
"legendFormat": "broker ready",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 8,
"type": "timeseries",
"title": "Oldest queued job age",
"description": "",
"gridPos": {
"x": 12,
"y": 24,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "max(lab_queue_oldest_age_seconds)",
"legendFormat": "age",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 9,
"type": "timeseries",
"title": "Database pool",
"description": "",
"gridPos": {
"x": 0,
"y": 32,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "lab_db_pool_used",
"legendFormat": "used {{service_instance_id}}",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "B",
"expr": "lab_db_pool_waiting",
"legendFormat": "waiting {{service_instance_id}}",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "C",
"expr": "lab_db_pool_capacity",
"legendFormat": "capacity {{service_instance_id}}",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 10,
"type": "timeseries",
"title": "Worker saturation",
"description": "",
"gridPos": {
"x": 12,
"y": 32,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "sum(lab_worker_busy) / clamp_min(sum(lab_worker_capacity),1)",
"legendFormat": "busy / capacity",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 11,
"type": "timeseries",
"title": "Container memory (or tree RSS fallback)",
"description": "",
"gridPos": {
"x": 0,
"y": 40,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "bytes"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "lab_container_memory_bytes",
"legendFormat": "{{service_name}} / {{service_instance_id}}",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 12,
"type": "timeseries",
"title": "Container CPU",
"description": "CPU cores: 1.0 = one logical core.",
"gridPos": {
"x": 12,
"y": 40,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "lab_container_cpu_cores",
"legendFormat": "{{service_name}} / {{service_instance_id}}",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 13,
"type": "timeseries",
"title": "Collector exporter queue",
"description": "",
"gridPos": {
"x": 0,
"y": 48,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "otelcol_exporter_queue_size",
"legendFormat": "{{exporter}} queue",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "B",
"expr": "otelcol_exporter_queue_capacity",
"legendFormat": "{{exporter}} capacity",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 14,
"type": "timeseries",
"title": "Collector failed exports",
"description": "",
"gridPos": {
"x": 12,
"y": 48,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "ops"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "rate(otelcol_exporter_send_failed_spans[30s]) or rate(otelcol_exporter_send_failed_spans_total[30s])",
"legendFormat": "spans {{exporter}}",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "B",
"expr": "rate(otelcol_exporter_send_failed_log_records[30s]) or rate(otelcol_exporter_send_failed_log_records_total[30s])",
"legendFormat": "logs {{exporter}}",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 15,
"type": "timeseries",
"title": "Alert state",
"description": "",
"gridPos": {
"x": 0,
"y": 56,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "ALERTS{alertname=~\"Lab.*\"}",
"legendFormat": "{{alertname}} / {{alertstate}}",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
},
{
"id": 16,
"type": "timeseries",
"title": "SLI: successful availability (5 min)",
"description": "1 \u2212 5xx/all business responses over 5 min; objective >= 99%. No data if no traffic.",
"gridPos": {
"x": 12,
"y": 56,
"w": 12,
"h": 8
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"refId": "A",
"expr": "1 - ((sum(increase(lab_http_requests_total{route=~\"/api/.*\",status_class=\"5xx\"}[5m])) or vector(0)) / sum(increase(lab_http_requests_total{route=~\"/api/.*\"}[5m])))",
"legendFormat": "actual SLI",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
},
{
"refId": "B",
"expr": "vector(0.99)",
"legendFormat": "SLO target 99%",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code"
}
]
}
]
}