Metrics: database timing, pool state, DB-backed gauges, gunicorn
- Statement latency by operation and connection-pool gauges via SQLAlchemy events - Users, active users (1h/24h/7d) and now-playing gauges computed at scrape time, cached for 60s, from a NullPool engine that is safe in the gunicorn master; exports nothing (not an error) if the DB is down - gunicorn.conf.py: multiprocess metrics aggregated across workers and served by the master on METRICS_PORT, stale files cleared at start, dead workers marked - Tests cover labels, in-flight gauge, DB metrics, the collector and a real two-worker gunicorn aggregation 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
89f8589424
commit
faa74871a5
7 files changed
+319
-7
No files matched your search
@@ -118,3 +118,10 @@ build_info = Gauge(
|
||||
multiprocess_mode="max",
|
||||
)
|
||||
build_info.labels(version=__version__, python_version=platform.python_version()).set(1)
|
||||
|
||||
# Gauges computed from the database by metrics.collectors.DatabaseStatsCollector.
|
||||
COLLECTED = {
|
||||
"users": "scrobbler_users",
|
||||
"active_users": "scrobbler_active_users",
|
||||
"now_playing_active": "scrobbler_now_playing_active",
|
||||
}
|
||||
Reference in new issue
Block a user