Commit 9018a61
fix(tracing): address PR #484 review — error status, obs fallback, handle leak, dd_only Temporal backend
Four review-comment fixes for the business<->obs correlation edge, each with unit
coverage:
- ADK span() CM recorded no error on a failing step, so a failed agent step closed
a green obs span. Now sets span error (guarded so obs can't shadow the app
exception) and re-raises. (tests/test_adk_tracing_span_error.py)
- In lgtm mode with no TracerProvider, open_obs_span returned a handle with empty
correlation, suppressing the ambient obs_correlation() fallback -> business span
got no obs_* ids. Now bails to None so the caller falls back.
(tests/test_obs_span_fallback.py)
- Obs-handle registry could leak (registration-order + start-without-end via public
API). Processor hooks now swallow (obs must never crash the app path) and the
registry is a bounded OrderedDict that evicts+closes the oldest.
(tests/test_obs_handle_registry.py)
- On the Temporal path the ambient span is the OTel interceptor span regardless of
SGP_OBS_MODE, but tag/read branched on mode -> in the default dd_only they
tagged/read an unrelated ddtrace span. Added prefer_otel (OTel-first, ddtrace
fallback) via a shared _begin_obs helper used by both start_span paths.
(tests/test_temporal_obs_backend.py)
Also: ObsSpanHandle.close() instead of reaching into _close; Iterator from
collections.abc.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 2740bac commit 9018a61
9 files changed
Lines changed: 712 additions & 68 deletions
File tree
- src/agentex/lib
- adk/_modules
- core
- temporal/services
- tracing
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
236 | 237 | | |
237 | 238 | | |
238 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
239 | 258 | | |
240 | 259 | | |
241 | 260 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
85 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
86 | 94 | | |
87 | 95 | | |
88 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| |||
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
85 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
86 | 103 | | |
87 | 104 | | |
88 | 105 | | |
| |||
124 | 141 | | |
125 | 142 | | |
126 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
127 | 151 | | |
128 | 152 | | |
129 | 153 | | |
130 | 154 | | |
131 | | - | |
| 155 | + | |
132 | 156 | | |
133 | 157 | | |
134 | 158 | | |
| |||
175 | 199 | | |
176 | 200 | | |
177 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
178 | 236 | | |
179 | 237 | | |
180 | 238 | | |
| 239 | + | |
181 | 240 | | |
182 | 241 | | |
183 | 242 | | |
| |||
188 | 247 | | |
189 | 248 | | |
190 | 249 | | |
191 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
192 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
193 | 263 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 264 | + | |
202 | 265 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
| 266 | + | |
211 | 267 | | |
212 | 268 | | |
213 | 269 | | |
| |||
222 | 278 | | |
223 | 279 | | |
224 | 280 | | |
225 | | - | |
| 281 | + | |
226 | 282 | | |
227 | 283 | | |
0 commit comments