Collector (contrib), Prometheus, Loki, Tempo and Grafana with provisioning from git; SDK in API and worker with level 3 metrics, traces and logs carrying trace_id/span_id; telemetry off by default outside the stand; broker healthcheck runs as the broker user so a fresh stand starts once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
239 lines
10 KiB
JSON
239 lines
10 KiB
JSON
{
|
|
"uid": "messenger-overview",
|
|
"title": "Messenger overview",
|
|
"description": "Level 3 signals of contracts/observability.md: API RPS, errors and duration, worker jobs and duration, logs and traces (design change otel-telemetry, decision 16). Provisioned from git, UI changes are not saved.",
|
|
"tags": ["messenger", "lab6"],
|
|
"timezone": "utc",
|
|
"editable": false,
|
|
"graphTooltip": 1,
|
|
"schemaVersion": 39,
|
|
"version": 1,
|
|
"refresh": "30s",
|
|
"time": {"from": "now-1h", "to": "now"},
|
|
"annotations": {"list": []},
|
|
"templating": {"list": []},
|
|
"links": [],
|
|
"panels": [
|
|
{
|
|
"id": 1,
|
|
"type": "row",
|
|
"title": "API (messenger-api)",
|
|
"collapsed": false,
|
|
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 0},
|
|
"panels": []
|
|
},
|
|
{
|
|
"id": 2,
|
|
"type": "timeseries",
|
|
"title": "Requests per second by route and status class",
|
|
"description": "Count of the http.server.request.duration histogram, all replicas; health is not recorded.",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 1},
|
|
"fieldConfig": {"defaults": {"unit": "reqps"}, "overrides": []},
|
|
"options": {"legend": {"displayMode": "table", "placement": "right", "calcs": ["lastNotNull"]}, "tooltip": {"mode": "multi", "sort": "desc"}},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "sum by (http_route, status_class) (label_replace(rate(http_server_request_duration_seconds_count{job=\"messenger-api\"}[5m]), \"status_class\", \"${1}xx\", \"http_response_status_code\", \"([0-9])..\"))",
|
|
"legendFormat": "{{http_route}} {{status_class}}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 3,
|
|
"type": "timeseries",
|
|
"title": "Error ratio (5xx of all requests)",
|
|
"description": "Numerator: API responses 5xx; denominator: all recorded requests. 4xx are shown separately; responses generated by the load balancer are not in API metrics.",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 6, "x": 12, "y": 1},
|
|
"fieldConfig": {"defaults": {"unit": "percentunit", "min": 0}, "overrides": []},
|
|
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "single"}},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\",http_response_status_code=~\"5..\"}[5m])) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\"}[5m]))",
|
|
"legendFormat": "5xx ratio"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 4,
|
|
"type": "timeseries",
|
|
"title": "Client errors ratio (4xx of all requests)",
|
|
"description": "Wrong password, foreign chat, validation: not part of the error ratio.",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 6, "x": 18, "y": 1},
|
|
"fieldConfig": {"defaults": {"unit": "percentunit", "min": 0}, "overrides": []},
|
|
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "single"}},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\",http_response_status_code=~\"4..\"}[5m])) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\"}[5m]))",
|
|
"legendFormat": "4xx ratio"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 5,
|
|
"type": "timeseries",
|
|
"title": "Request duration p50 and p95 (all replicas)",
|
|
"description": "Quantiles from the sum of buckets of all replicas, not averages of replicas.",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 9},
|
|
"fieldConfig": {"defaults": {"unit": "s", "min": 0}, "overrides": []},
|
|
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "histogram_quantile(0.5, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[5m])))",
|
|
"legendFormat": "p50"
|
|
},
|
|
{
|
|
"refId": "B",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[5m])))",
|
|
"legendFormat": "p95"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 6,
|
|
"type": "timeseries",
|
|
"title": "Request duration p95 by route",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 9},
|
|
"fieldConfig": {"defaults": {"unit": "s", "min": 0}, "overrides": []},
|
|
"options": {"legend": {"displayMode": "table", "placement": "right", "calcs": ["lastNotNull"]}, "tooltip": {"mode": "multi", "sort": "desc"}},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "histogram_quantile(0.95, sum by (le, http_route) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\"}[5m])))",
|
|
"legendFormat": "{{http_route}}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 7,
|
|
"type": "row",
|
|
"title": "Worker (messenger-worker)",
|
|
"collapsed": false,
|
|
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 17},
|
|
"panels": []
|
|
},
|
|
{
|
|
"id": 8,
|
|
"type": "timeseries",
|
|
"title": "Jobs per second by outcome",
|
|
"description": "Count of messenger.job.duration by messenger.job.outcome. Successful: ready; failed: failed, retry, requeued, dropped, error; skipped is neither.",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 18},
|
|
"fieldConfig": {"defaults": {"unit": "ops"}, "overrides": []},
|
|
"options": {"legend": {"displayMode": "table", "placement": "bottom", "calcs": ["lastNotNull"]}, "tooltip": {"mode": "multi", "sort": "desc"}},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "sum by (messenger_job_outcome) (rate(messenger_job_duration_seconds_count{job=\"messenger-worker\"}[5m]))",
|
|
"legendFormat": "{{messenger_job_outcome}}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 9,
|
|
"type": "timeseries",
|
|
"title": "Successful and failed jobs per second",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 18},
|
|
"fieldConfig": {"defaults": {"unit": "ops", "min": 0}, "overrides": []},
|
|
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "sum(rate(messenger_job_duration_seconds_count{job=\"messenger-worker\",messenger_job_outcome=\"ready\"}[5m]))",
|
|
"legendFormat": "successful (ready)"
|
|
},
|
|
{
|
|
"refId": "B",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "sum(rate(messenger_job_duration_seconds_count{job=\"messenger-worker\",messenger_job_outcome=~\"failed|retry|requeued|dropped|error\"}[5m]))",
|
|
"legendFormat": "failed"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 10,
|
|
"type": "timeseries",
|
|
"title": "Job duration p50 and p95 (ready)",
|
|
"description": "Handling of one delivery after the concurrency slot, outcome ready.",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 18},
|
|
"fieldConfig": {"defaults": {"unit": "s", "min": 0}, "overrides": []},
|
|
"options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "multi"}},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_job_duration_seconds_bucket{job=\"messenger-worker\",messenger_job_outcome=\"ready\"}[5m])))",
|
|
"legendFormat": "p50"
|
|
},
|
|
{
|
|
"refId": "B",
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket{job=\"messenger-worker\",messenger_job_outcome=\"ready\"}[5m])))",
|
|
"legendFormat": "p95"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 11,
|
|
"type": "row",
|
|
"title": "Logs and traces",
|
|
"collapsed": false,
|
|
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 26},
|
|
"panels": []
|
|
},
|
|
{
|
|
"id": 12,
|
|
"type": "logs",
|
|
"title": "API and worker logs",
|
|
"description": "Records of stdout exported through the Collector; trace_id opens the trace in Tempo.",
|
|
"datasource": {"type": "loki", "uid": "loki"},
|
|
"gridPos": {"h": 12, "w": 24, "x": 0, "y": 27},
|
|
"options": {"showTime": true, "showLabels": false, "wrapLogMessage": true, "sortOrder": "Descending", "enableLogDetails": true, "dedupStrategy": "none", "prettifyLogMessage": false},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "loki", "uid": "loki"},
|
|
"expr": "{service_name=~\"messenger-.*\"}",
|
|
"queryType": "range"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 13,
|
|
"type": "table",
|
|
"title": "Recent traces",
|
|
"description": "TraceQL search of API requests and worker deliveries; a trace opens with links to its logs.",
|
|
"datasource": {"type": "tempo", "uid": "tempo"},
|
|
"gridPos": {"h": 10, "w": 24, "x": 0, "y": 39},
|
|
"options": {"showHeader": true},
|
|
"targets": [
|
|
{
|
|
"refId": "A",
|
|
"datasource": {"type": "tempo", "uid": "tempo"},
|
|
"queryType": "traceql",
|
|
"query": "{ resource.service.name =~ \"messenger-.*\" }",
|
|
"limit": 20,
|
|
"tableType": "traces"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|