Tag traced requests with the session id and OIDC sub

This commit is contained in:
2026-09-28 05:11:22 +08:00
parent bcd1371019
commit 834f1f26a9
5 changed files with 173 additions and 3 deletions
+5 -1
View File
@@ -134,7 +134,11 @@ With `OTEL_ENABLED` set, the app exports over OTLP/HTTP (kaya-otel plus
database spans for the Postgres (asyncpg, through Tortoise) and Redis
clients. Redis command values are redacted by the instrumentation
(`GET ? ?`) and asyncpg spans carry the parameterized SQL only — no
parameter values.
parameter values. Each HTTP/WebSocket span is tagged with the request's
session and user, so all traces of a session can be found together:
`session.id` is a truncated SHA-256 of the session id (the cookie is a
credential, so it is never exported verbatim) and `user.id` is the OIDC
`sub`, present once logged in.
- **Metrics**: the HTTP server metrics from kaya-otel, plus
`tavolo.active_users` (sessions in the session store),
`tavolo.ongoing_games` (live matches not finished yet, maintained by the