Commit 533dc1f
Hoist stats whole_key collapse counter off the per-dropped-span map lookup
The collapsed:whole_key counter is incremented once per dropped span on the
aggregator thread (Aggregator, findOrInsert == null branch), unlike every other
collapse reason which is batched once per reporting cycle. Under a cardinality
explosion the aggregate table pins at cap and every arriving span is dropped,
turning that path hot on an already-bottlenecked thread -- yet it went through a
ConcurrentHashMap.computeIfAbsent lookup on StatsMetrics per span.
Pre-create the whole_key TaggedCounter at construction (still registered in the
reason map so the telemetry drain picks it up unchanged) and add a dedicated
onWholeKeyCollapse() that increments the cached reference directly. The hot path
no longer touches the map; the batched reasons still route through
onCollapsedSpans as before.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 302b882 commit 533dc1f
2 files changed
Lines changed: 20 additions & 5 deletions
File tree
- dd-trace-core/src/main/java/datadog/trace/common/metrics
- internal-api/src/main/java/datadog/trace/api/metrics
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 19 | | |
24 | 20 | | |
25 | 21 | | |
| |||
161 | 157 | | |
162 | 158 | | |
163 | 159 | | |
164 | | - | |
| 160 | + | |
165 | 161 | | |
166 | 162 | | |
167 | 163 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
34 | 44 | | |
35 | 45 | | |
36 | 46 | | |
| |||
51 | 61 | | |
52 | 62 | | |
53 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
54 | 73 | | |
55 | 74 | | |
56 | 75 | | |
| |||
0 commit comments