Monitoring stack, containers and dashboards
- API image (uv multi-stage, non-root, gunicorn, migrations on start, health check) and UI image (nginx, CSP, config.js rendered from API_BASE_URL); /healthz documented in OpenAPI - docker compose runs db, api and ui; the "monitoring" profile adds Prometheus, postgres-exporter and Grafana, all provisioned from files - Grafana dashboards: API overview (RED), Last.fm API, Usage, Database - Prometheus alert rules: API down, error rate, latency, auth failure spike, ignored scrobbles, DB pool saturation, Postgres down - Pool checkout gauge counts events (the pool's own counters lag the checkin event); error ratios show 0 instead of "No data" - Tests check dashboards and alerts only use metrics that exist - scripts/generate_traffic.py drives realistic traffic for demos Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
1 parent
faa74871a5
commit
ea705589f1
28 files changed
+3508
-14
No files matched your search
@@ -992,6 +992,40 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/healthz": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"503": {
|
||||
"description": "The database is unreachable",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Health"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"$ref": "#/components/responses/DEFAULT_ERROR"
|
||||
}
|
||||
},
|
||||
"summary": "Health check",
|
||||
"description": "Returns 200 when the API can reach its database.",
|
||||
"tags": [
|
||||
"Health"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/2.0/": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -1495,6 +1529,10 @@
|
||||
"name": "Stats",
|
||||
"description": "Your listening history and statistics"
|
||||
},
|
||||
{
|
||||
"name": "Health",
|
||||
"description": "Liveness for load balancers and containers"
|
||||
},
|
||||
{
|
||||
"name": "Last.fm",
|
||||
"description": "Last.fm-compatible API for players and scrobblers"
|
||||
@@ -1936,6 +1974,16 @@
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"Health": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"status": {
|
||||
"type": "string",
|
||||
"example": "ok"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"LastfmError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in new issue
Block a user