Files
mtusi2026lab6/observability/grafana/dashboards/messenger-lab6.json

246 lines
5.8 KiB
JSON

{
"uid": "messenger-lab6",
"title": "Messenger Lab6 - Observability",
"tags": ["lab6", "messenger", "opentelemetry"],
"timezone": "browser",
"schemaVersion": 41,
"version": 1,
"refresh": "5s",
"time": {
"from": "now-30m",
"to": "now"
},
"annotations": {
"list": []
},
"templating": {
"list": []
},
"panels": [
{
"id": 1,
"title": "API - Requests per second",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0, "y": 0, "w": 12, "h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum(rate(messenger_messenger_http_requests_total[2m]))",
"legendFormat": "All business requests"
}
],
"fieldConfig": {
"defaults": {
"unit": "reqps",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 2,
"title": "API - HTTP 5xx error ratio",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12, "y": 0, "w": 12, "h": 8
},
"targets": [
{
"refId": "A",
"expr": "(100 * sum(rate(messenger_messenger_http_requests_total{http_status_class=\"5xx\"}[2m])) / clamp_min(sum(rate(messenger_messenger_http_requests_total[2m])), 0.000001)) or vector(0)",
"legendFormat": "5xx / all business requests"
}
],
"fieldConfig": {
"defaults": {
"unit": "percent",
"min": 0,
"max": 100
},
"overrides": []
}
},
{
"id": 3,
"title": "API - HTTP p95 duration",
"description": "OTel FastAPI duration histogram is in milliseconds; result converted to seconds.",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0, "y": 8, "w": 12, "h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_http_server_duration_milliseconds_bucket[5m]))) / 1000",
"legendFormat": "p95 HTTP duration"
}
],
"fieldConfig": {
"defaults": {
"unit": "s",
"min": 0
},
"overrides": []
}
},
{
"id": 4,
"title": "Worker - Jobs by outcome",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12, "y": 8, "w": 12, "h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum by (outcome) (increase(messenger_messenger_worker_jobs_processed_total[5m]))",
"legendFormat": "{{outcome}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"min": 0
},
"overrides": []
}
},
{
"id": 5,
"title": "Worker - Processing p95 duration",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0, "y": 16, "w": 12, "h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_messenger_worker_job_duration_seconds_bucket[5m])))",
"legendFormat": "p95 job duration"
}
],
"fieldConfig": {
"defaults": {
"unit": "s",
"min": 0
},
"overrides": []
}
},
{
"id": 6,
"title": "Worker - Completed job attempts",
"type": "stat",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12, "y": 16, "w": 12, "h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum(messenger_messenger_worker_jobs_processed_total)",
"legendFormat": "Processing attempts"
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 0
},
"overrides": []
},
"options": {
"reduceOptions": {
"values": false,
"calcs": ["lastNotNull"]
}
}
},
{
"id": 7,
"title": "API - Structured logs",
"type": "logs",
"datasource": {
"type": "loki",
"uid": "loki"
},
"gridPos": {
"x": 0, "y": 24, "w": 24, "h": 9
},
"targets": [
{
"refId": "A",
"expr": "{service_name=\"messenger-api\"}",
"queryType": "range"
}
],
"options": {
"showTime": true,
"showLabels": true,
"showCommonLabels": false,
"enableLogDetails": true,
"wrapLogMessage": true,
"sortOrder": "Descending"
}
},
{
"id": 8,
"title": "Worker - Structured logs",
"type": "logs",
"datasource": {
"type": "loki",
"uid": "loki"
},
"gridPos": {
"x": 0, "y": 33, "w": 24, "h": 9
},
"targets": [
{
"refId": "A",
"expr": "{service_name=\"messenger-worker\"}",
"queryType": "range"
}
],
"options": {
"showTime": true,
"showLabels": true,
"showCommonLabels": false,
"enableLogDetails": true,
"wrapLogMessage": true,
"sortOrder": "Descending"
}
}
]
}