Repository navigation
Commit 9c2c1bf
committed
fix(ag2): keep BoundedAttributes and the dropped count on normalized spans
R7: AG2SpanProcessor.on_end replaced span._attributes with a plain dict.
ReadableSpan.dropped_attributes (exported as dropped_attributes_count)
reads BoundedAttributes.dropped and returns 0 for anything else, so
every normalized AG2 span reported 0 dropped attributes, and the span's
max_span_attributes / max_attribute_length limits and its ended-span
immutability were lost.
on_end now rebuilds a BoundedAttributes with the previous maxlen,
max_value_len and immutability, and carries the previous dropped count
over. Keys the processor adds count against the same limit: on a span
already full, the oldest key is evicted and counted, as the SDK does
(only reachable at the limit, 128 by default). Docstring, README note
and CHANGELOG updated.
Tests first, red on c1196a4 (2 failed):
test_normalizing_keeps_the_sdk_dropped_attribute_count (assert 0 == 1
on span.dropped_attributes) and
test_keys_the_processor_adds_count_against_span_limits (plain dict kept
3 keys over a limit of 2). Green: 88 passed on ag2 1.1.2.
approved: Nikhil 2026-10-03 blanket
Refs: TH-82361 parent c1196a4 commit 9c2c1bf
4 files changed
Lines changed: 73 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
190 | 193 | | |
191 | 194 | | |
192 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
288 | 328 | | |
289 | 329 | | |
290 | 330 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
235 | 236 | | |
236 | 237 | | |
237 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
238 | 262 | | |
239 | 263 | | |
240 | 264 | | |
| |||
331 | 355 | | |
332 | 356 | | |
333 | 357 | | |
334 | | - | |
| 358 | + | |
335 | 359 | | |
336 | 360 | | |
337 | 361 | | |
| |||
0 commit comments