Commit 4188b43
Bound configurable trace-stats cardinality limit
A mis-set trace.stats.<tag>.cardinality.limit flowed straight into
TagCardinalityHandler, which eagerly allocates four reference arrays of
nextPow2(limit * 2) slots. A large value could exhaust the heap while the
aggregator is constructed, before the tracer finished starting.
Cap the accepted value at 1 << 16 (~2 MB per handler worst case, far above
the largest built-in default of 1024) and fall back to the default with a
warning when it is exceeded, mirroring the existing <= 0 fallback.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 01bf9fe commit 4188b43
2 files changed
Lines changed: 48 additions & 1 deletion
File tree
- internal-api/src
- main/java/datadog/trace/api
- test/java/datadog/trace/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3895 | 3895 | | |
3896 | 3896 | | |
3897 | 3897 | | |
| 3898 | + | |
| 3899 | + | |
| 3900 | + | |
| 3901 | + | |
| 3902 | + | |
| 3903 | + | |
| 3904 | + | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
| 3908 | + | |
3898 | 3909 | | |
3899 | 3910 | | |
3900 | 3911 | | |
| |||
3903 | 3914 | | |
3904 | 3915 | | |
3905 | 3916 | | |
3906 | | - | |
| 3917 | + | |
| 3918 | + | |
| 3919 | + | |
3907 | 3920 | | |
3908 | 3921 | | |
3909 | 3922 | | |
| |||
3916 | 3929 | | |
3917 | 3930 | | |
3918 | 3931 | | |
| 3932 | + | |
| 3933 | + | |
| 3934 | + | |
| 3935 | + | |
| 3936 | + | |
| 3937 | + | |
| 3938 | + | |
| 3939 | + | |
| 3940 | + | |
3919 | 3941 | | |
3920 | 3942 | | |
3921 | 3943 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
32 | 57 | | |
0 commit comments