forked from mtusi2026/mtusi2026lab6
226 lines
4.7 KiB
JSON
226 lines
4.7 KiB
JSON
{
|
|
"uid": "messenger-lab6",
|
|
"title": "Messenger — Lab 6",
|
|
"schemaVersion": 41,
|
|
"version": 2,
|
|
"refresh": "5s",
|
|
"time": {
|
|
"from": "now-15m",
|
|
"to": "now"
|
|
},
|
|
"panels": [
|
|
{
|
|
"id": 1,
|
|
"title": "API RPS",
|
|
"type": "timeseries",
|
|
"datasource": {
|
|
"type": "prometheus",
|
|
"uid": "prometheus"
|
|
},
|
|
"gridPos": {
|
|
"x": 0,
|
|
"y": 0,
|
|
"w": 12,
|
|
"h": 8
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "sum by (method,route) (rate(api_requests_total{route!~\"/health/.*\"}[1m]))",
|
|
"refId": "A",
|
|
"legendFormat": "{{outcome}} {{method}} {{route}}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"unit": "reqps"
|
|
},
|
|
"overrides": []
|
|
}
|
|
},
|
|
{
|
|
"id": 2,
|
|
"title": "API 5xx / all business requests",
|
|
"type": "timeseries",
|
|
"datasource": {
|
|
"type": "prometheus",
|
|
"uid": "prometheus"
|
|
},
|
|
"gridPos": {
|
|
"x": 12,
|
|
"y": 0,
|
|
"w": 12,
|
|
"h": 8
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "(sum(rate(api_requests_total{status_class=\"5xx\",route!~\"/health/.*\"}[1m])) or vector(0)) / clamp_min(sum(rate(api_requests_total{route!~\"/health/.*\"}[1m])),0.001)",
|
|
"refId": "A",
|
|
"legendFormat": "{{outcome}} {{method}} {{route}}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"unit": "percentunit"
|
|
},
|
|
"overrides": []
|
|
}
|
|
},
|
|
{
|
|
"id": 3,
|
|
"title": "API p95 seconds",
|
|
"type": "timeseries",
|
|
"datasource": {
|
|
"type": "prometheus",
|
|
"uid": "prometheus"
|
|
},
|
|
"gridPos": {
|
|
"x": 0,
|
|
"y": 8,
|
|
"w": 12,
|
|
"h": 8
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "histogram_quantile(0.95,sum by (le) (rate(api_duration_seconds_bucket{route!~\"/health/.*\"}[1m])))",
|
|
"refId": "B",
|
|
"legendFormat": "p95"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"unit": "s"
|
|
},
|
|
"overrides": []
|
|
}
|
|
},
|
|
{
|
|
"id": 4,
|
|
"title": "Worker jobs / sec",
|
|
"type": "timeseries",
|
|
"datasource": {
|
|
"type": "prometheus",
|
|
"uid": "prometheus"
|
|
},
|
|
"gridPos": {
|
|
"x": 12,
|
|
"y": 8,
|
|
"w": 12,
|
|
"h": 8
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "sum by (outcome) (rate(worker_jobs_total[1m]))",
|
|
"refId": "A",
|
|
"legendFormat": "{{outcome}} {{method}} {{route}}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"unit": "ops"
|
|
},
|
|
"overrides": []
|
|
}
|
|
},
|
|
{
|
|
"id": 5,
|
|
"title": "Worker p95 seconds",
|
|
"type": "timeseries",
|
|
"datasource": {
|
|
"type": "prometheus",
|
|
"uid": "prometheus"
|
|
},
|
|
"gridPos": {
|
|
"x": 0,
|
|
"y": 16,
|
|
"w": 12,
|
|
"h": 8
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "histogram_quantile(0.95,sum by (le) (rate(worker_duration_seconds_bucket[1m])))",
|
|
"refId": "A",
|
|
"legendFormat": "{{outcome}} {{method}} {{route}}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"unit": "s"
|
|
},
|
|
"overrides": []
|
|
}
|
|
},
|
|
{
|
|
"id": 6,
|
|
"title": "Worker total attempts",
|
|
"type": "timeseries",
|
|
"datasource": {
|
|
"type": "prometheus",
|
|
"uid": "prometheus"
|
|
},
|
|
"gridPos": {
|
|
"x": 12,
|
|
"y": 16,
|
|
"w": 12,
|
|
"h": 8
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "sum by (outcome) (worker_jobs_total)",
|
|
"refId": "A",
|
|
"legendFormat": "{{outcome}} {{method}} {{route}}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"unit": "short"
|
|
},
|
|
"overrides": []
|
|
}
|
|
},
|
|
{
|
|
"id": 7,
|
|
"title": "API and worker structured logs",
|
|
"type": "logs",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"gridPos": {
|
|
"x": 0,
|
|
"y": 24,
|
|
"w": 24,
|
|
"h": 10
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "{service_name=~\"messenger-api|messenger-worker\"}",
|
|
"refId": "A"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 8,
|
|
"title": "Real application traces",
|
|
"type": "table",
|
|
"datasource": {
|
|
"type": "tempo",
|
|
"uid": "tempo"
|
|
},
|
|
"gridPos": {
|
|
"x": 0,
|
|
"y": 34,
|
|
"w": 24,
|
|
"h": 8
|
|
},
|
|
"targets": [
|
|
{
|
|
"queryType": "traceql",
|
|
"query": "{resource.service.name =~ \"messenger-api|messenger-worker\"}",
|
|
"refId": "A",
|
|
"limit": 20
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|