"""Bot observability metrics (read-only) for the ERP admin dashboard page. Reads the bot's own tables (bot_traces / bot_trace_events — owned and written by the Bale bot container) with plain SELECTs only. Admin-gated. Calibration, demo and test traffic (source != 'bale' / chat_id = 0) is excluded from the aggregates; the traces endpoint can show everything with ?include_synthetic=1. v2.1: per-MODEL and per-SECTION records (/models, /stages), message text excerpts on /traces, and media serving (voice/attachment playback+download) streamed from the bot's MinIO bucket with an on-disk fallback, via a short-lived signed URL —