Commit 63ca57f
fix(tracing): drain sync tracing processors on ACP shutdown
A sync ACP agent silently lost whatever business spans were still queued when the
pod stopped. The lifespan drained `shutdown_default_span_queue`, which is the ASYNC
path only; the sync tracing processors hold their own queue and nothing in the SDK
ever shut them down. `get_sync_tracing_processors()` had exactly one caller —
tracer.py, to CONSTRUCT a Trace — and no shutdown path at all.
This is the same class of bug as the missing `sgp_obs.shutdown()` in the previous
commit, and it compounds it from the other end. The business span is what an obs
span's `agentex.business_trace_id` resolves to, so dropping it breaks the pivot from
Tempo back to the SGP store — the backward edge points at a record that was never
written.
Found while working out what the obs-test-* agents in agentex-agents#2183 would still
need after the SDK absorbs their bootstrap: each one carries a `sgp_flush_lifespan`
that does exactly this, which is the tell that the SDK should have been doing it.
Each processor is isolated — one that hangs or raises must not strand the spans held
by the ones after it, and none of them may stop the pod shutting down.
The last test pins the wiring rather than just the helper: a drain nothing calls is
worthless, so it asserts the lifespan actually invokes both this and shutdown_sgp_obs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 777ca59 commit 63ca57f
3 files changed
Lines changed: 113 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
122 | 156 | | |
123 | 157 | | |
124 | 158 | | |
| |||
191 | 225 | | |
192 | 226 | | |
193 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
194 | 233 | | |
195 | 234 | | |
196 | 235 | | |
| |||
199 | 238 | | |
200 | 239 | | |
201 | 240 | | |
| 241 | + | |
202 | 242 | | |
203 | 243 | | |
204 | 244 | | |
| |||
Whitespace-only changes.
Lines changed: 73 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
0 commit comments