Repository navigation
Commit 49f0f6d
perf(tracing): skip span attribute limit checks when the span has room (#2007)
* perf(tracing): skip span attribute limit checks when the span has room
Every SDK attribute write runs the span attribute limit guard, which did a
membership check on the span attributes for each new and reserved key. On
OTel's BoundedAttributes each miss raises and catches a KeyError.
- Return early when existing + new + reserved keys fit, an upper bound of
the exact count, so no drop decision changes.
- On the slow path, snapshot the existing keys into a set once.
- Precompute the span-like observation types.
- Write type, environment and release in one guarded call.
* test: keep the observation type when environment and release do not fit
* perf(tracing): keep only the span attribute limit early return
Drop the key-set snapshot, the precomputed span-like type set and the
batched observation init write. The early return carries almost all of the
gain, and without the batched write the warnings match main exactly.
Co-authored-by: hassieb.pakzad <hassieb.pakzad@clickhouse.com>
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: hassieb.pakzad <hassieb.pakzad@clickhouse.com>1 parent a266fde commit 49f0f6d
2 files changed
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
150 | 154 | | |
151 | 155 | | |
152 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
517 | 555 | | |
518 | 556 | | |
519 | 557 | | |
| |||
0 commit comments