Skip to content
Source
Sign inSign up
pingdotgg/t3code

Server traces cover about 20 minutes with seven agents streaming, and each streamed event writes 9 spans #18917

Closedbompus(GitHub profile, opens in a new tab) opened this issue 0 comments

What happened

The server trace keeps 10 files of 10 MiB. With about seven agents streaming they rotate every 1.5 to 3 minutes, so the window covers roughly 20 minutes. In a 21-minute sample (212,821 spans, 111 MB), three kinds of low-value spans make up about 30% of the bytes: per-statement sqlite spans inside each event write (24%), the startup attributes server.mode, server.port, server.host and startup.phase copied onto every effect-worker span for the life of the server (3%), and three project-lookup helper spans next to getAvailable's own (4.5%).

Diagnosis

Each streamed event is one event-sink write: a sql.transaction span plus about five statement spans (9 spans, 4,855 bytes). The startup attributes are leaked because annotateSpans wraps a startup phase that forks the worker. PR #18106 turns the tracer off inside the transaction body (the sql.transaction span still times each write), passes the attributes to withSpan instead, and uses Effect.fnUntraced for the three helpers. Per event write: 9 to 2 spans, 4,855 to 828 bytes (3,000 writes through the real EventSink on in-memory SQLite, 3 runs). Replaying the 111 MB sample without the removed spans gives about 30% fewer bytes. Tracing CPU was about 0.1 ms per write, so the gain is history length and disk, not CPU. Cost: per-statement timing inside an event write is gone; a slow commit still shows as a long transaction.

Steps to reproduce

Run the server with several agents streaming and inspect server.trace.ndjson and its rotated files, or run the benchmark described in PR #18106.

Version

0.0.44

Environment

Linux (WSL2), server only. Exact runtime is in the PR body.

Evidence

Spans per event write 9 to 2; bytes 4,855 to 828. Wall times varied by about 15% between runs and are not claimed.

#8764, #15707, #16202 (earlier PR, closed)

Fix applied or workaround

Open as #18106, three separable commits. The first drops per-statement timing, which changes what the trace records, so I am asking for your direction. #8764 asks for a way to turn export off; this keeps export and drops low-value spans. I can split the PR into three.

Filed by

claude (sonnet-5.5) via t3 triage

  1. bompus(GitHub profile, opens in a new tab) added labelsvia-triage

Sign in to join this conversation.