The local trace file burned through its whole 100 MB rotation window in
10-36 minutes, which made incident audits impossible: by the time a
slow-PR-badge report came in, the relevant spans were already rotated
away. Two sources dominated: the terminal subprocess poller (~40% of
bytes: pgrep + up to three ps spawns per session per second, each a full
process-table enumeration) and sql.execute spans (~28%).
Write less:
- One shared ps/powershell process-table snapshot per poll tick serves
every running terminal; per-session inspection is now pure lookup.
This also removes 50-75 process spawns/sec on busy hosts.
- The poll tick runs untraced; an explicit
terminal.subprocessActivityChanged span fires only on a real state
flip.
- Tail policy in the local file tracer: failures, interruptions, spans
with events, and slow spans always persist; fast successes are
rate-limited per span name (50 per 30s). OTLP delegate still sees
every span. T3CODE_TRACE_KEEP_ALL_SPANS=true restores full fidelity.
- Dropped constant db.name/service.name attributes from every
sql.execute span.
Keep more:
- Rotated trace backups are gzipped (measured 10.6x on real span data)
and T3CODE_TRACE_MAX_FILES now defaults to 30, so the same disk
budget covers hours.
- TraceDiagnostics reads backups one file at a time (instead of
slurping every rotation into memory) and transparently gunzips .gz
backups; plain legacy backups still age along the chain.
Co-Authored-By: Claude Fable 5 <[email protected]>