Skip to content

[Debugger] Add global rate limiter#8480

Merged
dudikeleti merged 8 commits into
masterfrom
dudik/probes-global-rate-limit
May 26, 2026
Merged

[Debugger] Add global rate limiter#8480
dudikeleti merged 8 commits into
masterfrom
dudik/probes-global-rate-limit

Conversation

@dudikeleti

@dudikeleti dudikeleti commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

  • Add a process-wide Dynamic Instrumentation global rate limiter for snapshot probes.
  • Run the global snapshot limiter before the per-probe sampler so the
    adaptive global sampler observes the full snapshot traffic and stays
    correctly calibrated.
  • Leave pure log probes on their existing per-probe limiter only.
  • Wire Live Debugging service sampling config through ConfigurationUpdater, and DynamicInstrumentation.
  • Dispose timer-backed adaptive samplers when global or per-probe limiters are replaced, removed, or shut down.
  • Add focused tests for global limiter defaults/configuration, sampling order, sampler disposal, configuration updates, and debugger lifecycle behavior.

Reason for change

  • Per-probe rate limiting protects each individual snapshot probe, but it does not protect the process from aggregate snapshot volume when many probes are active at once.
  • This adds a simple local safety valve now, without trying to model the backend hourly probe budget in the tracer.
  • Pure log probes are intentionally excluded.
  • This also fixes sampler ownership leaks where timer-backed AdaptiveSampler instances could stay rooted after replacement/removal.

Implementation details

  • DebuggerGlobalRateLimiter owns one adaptive sampler for snapshot probes.
    • Default snapshot global cap: 100/s.
  • ServiceConfiguration.Sampling.SnapshotsPerSecond updates the snapshot global limiter. When no service sampling config is present, the limiter falls back to its default.
  • ProbeProcessor samples snapshot probes in this order:
    • condition evaluation, when applicable
    • global snapshot limiter
    • per-probe sampler
  • Pure log probes, metric probes, and span decoration probes are unchanged and do not consume the global limiter.
  • The current limiter is intentionally a naive per-process per-second limiter. Future work can evolve this behind the same abstraction into token-bucket behavior.
  • AdaptiveSamplerLifetime centralizes sampler creation, replacement, and disposal so losing add races and removed probes do not leak timers.

Test coverage

  • DebuggerGlobalRateLimiterTests|ConfigurationUpdaterTests|ProbeRateLimiterTests

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Apr 18, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8480) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration72.37 ± (72.36 - 72.71) ms72.70 ± (72.71 - 73.06) ms+0.5%✅⬆️
.NET Framework 4.8 - Bailout
duration78.71 ± (78.69 - 79.17) ms76.77 ± (76.67 - 77.09) ms-2.5%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1104.12 ± (1106.74 - 1114.93) ms1109.80 ± (1110.27 - 1118.50) ms+0.5%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.82 ± (22.76 - 22.89) ms22.57 ± (22.53 - 22.62) ms-1.1%
process.time_to_main_ms86.60 ± (86.18 - 87.01) ms84.32 ± (84.13 - 84.50) ms-2.6%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.91 ± (10.91 - 10.91) MB10.93 ± (10.92 - 10.93) MB+0.2%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.71 ± (22.66 - 22.76) ms22.84 ± (22.78 - 22.89) ms+0.6%✅⬆️
process.time_to_main_ms87.36 ± (87.10 - 87.61) ms88.15 ± (87.87 - 88.42) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.95 ± (10.95 - 10.96) MB10.95 ± (10.95 - 10.96) MB+0.0%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms212.48 ± (211.61 - 213.34) ms214.28 ± (213.23 - 215.33) ms+0.8%✅⬆️
process.time_to_main_ms539.14 ± (537.84 - 540.45) ms542.82 ± (541.58 - 544.06) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.61 ± (48.57 - 48.64) MB48.62 ± (48.59 - 48.65) MB+0.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.2%
.NET 6 - Baseline
process.internal_duration_ms21.30 ± (21.25 - 21.34) ms21.57 ± (21.51 - 21.63) ms+1.3%✅⬆️
process.time_to_main_ms73.88 ± (73.69 - 74.08) ms75.13 ± (74.84 - 75.42) ms+1.7%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.63 ± (10.63 - 10.64) MB10.63 ± (10.63 - 10.64) MB-0.0%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.63 ± (21.52 - 21.73) ms21.46 ± (21.41 - 21.51) ms-0.8%
process.time_to_main_ms77.62 ± (77.25 - 77.99) ms76.24 ± (76.03 - 76.44) ms-1.8%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.75 ± (10.74 - 10.75) MB10.75 ± (10.74 - 10.75) MB-0.0%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms370.84 ± (368.90 - 372.78) ms371.37 ± (369.16 - 373.57) ms+0.1%✅⬆️
process.time_to_main_ms549.26 ± (548.10 - 550.43) ms552.37 ± (550.90 - 553.84) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed50.05 ± (50.03 - 50.07) MB50.11 ± (50.08 - 50.13) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.3%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.30 ± (19.27 - 19.33) ms19.40 ± (19.36 - 19.44) ms+0.5%✅⬆️
process.time_to_main_ms72.31 ± (72.12 - 72.50) ms72.70 ± (72.50 - 72.89) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.70 ± (7.69 - 7.70) MB7.68 ± (7.68 - 7.69) MB-0.2%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.39 ± (19.35 - 19.44) ms19.69 ± (19.64 - 19.74) ms+1.5%✅⬆️
process.time_to_main_ms74.66 ± (74.40 - 74.91) ms76.52 ± (76.26 - 76.77) ms+2.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.74 ± (7.73 - 7.74) MB7.73 ± (7.73 - 7.74) MB-0.1%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms295.91 ± (293.86 - 297.96) ms295.42 ± (293.18 - 297.65) ms-0.2%
process.time_to_main_ms495.11 ± (494.01 - 496.21) ms496.16 ± (495.07 - 497.25) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.96 ± (36.94 - 36.99) MB36.96 ± (36.93 - 36.99) MB-0.0%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.1%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration195.83 ± (195.70 - 196.58) ms197.09 ± (196.80 - 197.67) ms+0.6%✅⬆️
.NET Framework 4.8 - Bailout
duration200.28 ± (199.97 - 201.03) ms199.69 ± (199.61 - 200.39) ms-0.3%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1188.87 ± (1189.62 - 1194.96) ms1185.81 ± (1186.07 - 1192.67) ms-0.3%
.NET Core 3.1 - Baseline
process.internal_duration_ms193.17 ± (192.72 - 193.62) ms191.08 ± (190.61 - 191.55) ms-1.1%
process.time_to_main_ms83.85 ± (83.48 - 84.21) ms82.46 ± (82.22 - 82.70) ms-1.7%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.20 ± (16.17 - 16.23) MB16.09 ± (16.07 - 16.12) MB-0.7%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.0%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms192.38 ± (191.91 - 192.86) ms190.91 ± (190.44 - 191.39) ms-0.8%
process.time_to_main_ms84.57 ± (84.26 - 84.89) ms83.74 ± (83.49 - 83.99) ms-1.0%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.21 ± (16.18 - 16.25) MB16.12 ± (16.09 - 16.15) MB-0.6%
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (20 - 21)-0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms383.42 ± (382.06 - 384.78) ms383.31 ± (382.03 - 384.59) ms-0.0%
process.time_to_main_ms532.88 ± (531.64 - 534.11) ms532.65 ± (531.58 - 533.71) ms-0.0%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.25 ± (57.15 - 57.35) MB57.25 ± (57.14 - 57.36) MB-0.0%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.1%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms195.54 ± (195.07 - 196.02) ms195.76 ± (195.23 - 196.30) ms+0.1%✅⬆️
process.time_to_main_ms71.31 ± (71.11 - 71.52) ms71.61 ± (71.35 - 71.86) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.37 ± (16.34 - 16.40) MB16.41 ± (16.39 - 16.44) MB+0.3%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.5%
.NET 6 - Bailout
process.internal_duration_ms194.84 ± (194.35 - 195.32) ms195.01 ± (194.48 - 195.55) ms+0.1%✅⬆️
process.time_to_main_ms72.14 ± (71.97 - 72.32) ms72.58 ± (72.36 - 72.81) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.46 ± (16.43 - 16.49) MB16.46 ± (16.43 - 16.48) MB-0.0%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.4%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms584.35 ± (581.64 - 587.06) ms585.25 ± (582.55 - 587.95) ms+0.2%✅⬆️
process.time_to_main_ms536.24 ± (535.28 - 537.21) ms539.20 ± (538.27 - 540.12) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.12 ± (61.04 - 61.20) MB61.12 ± (61.05 - 61.19) MB+0.0%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)-0.1%
.NET 8 - Baseline
process.internal_duration_ms193.45 ± (192.87 - 194.02) ms193.18 ± (192.73 - 193.62) ms-0.1%
process.time_to_main_ms71.18 ± (70.95 - 71.42) ms70.94 ± (70.70 - 71.18) ms-0.3%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.74 ± (11.72 - 11.76) MB11.74 ± (11.72 - 11.76) MB+0.0%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.4%
.NET 8 - Bailout
process.internal_duration_ms192.69 ± (192.29 - 193.10) ms192.74 ± (192.25 - 193.24) ms+0.0%✅⬆️
process.time_to_main_ms72.16 ± (71.93 - 72.38) ms71.99 ± (71.77 - 72.21) ms-0.2%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.79 ± (11.76 - 11.81) MB11.82 ± (11.80 - 11.84) MB+0.3%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.1%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms511.81 ± (509.20 - 514.43) ms510.98 ± (508.74 - 513.22) ms-0.2%
process.time_to_main_ms489.47 ± (488.58 - 490.36) ms488.80 ± (487.88 - 489.73) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.69 ± (50.65 - 50.73) MB50.65 ± (50.61 - 50.70) MB-0.1%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 30)+0.5%✅⬆️
Comparison explanation

Execution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8480) - mean (73ms)  : 70, 76
    master - mean (73ms)  : 70, 75

    section Bailout
    This PR (8480) - mean (77ms)  : 74, 79
    master - mean (79ms)  : 75, 82

    section CallTarget+Inlining+NGEN
    This PR (8480) - mean (1,114ms)  : 1055, 1173
    master - mean (1,111ms)  : 1049, 1173

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8480) - mean (114ms)  : 110, 117
    master - mean (116ms)  : 110, 122

    section Bailout
    This PR (8480) - mean (118ms)  : 112, 124
    master - mean (117ms)  : 112, 122

    section CallTarget+Inlining+NGEN
    This PR (8480) - mean (793ms)  : 773, 814
    master - mean (788ms)  : 761, 814

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8480) - mean (103ms)  : 97, 109
    master - mean (102ms)  : 97, 107

    section Bailout
    This PR (8480) - mean (104ms)  : 100, 109
    master - mean (106ms)  : 99, 113

    section CallTarget+Inlining+NGEN
    This PR (8480) - mean (960ms)  : 923, 997
    master - mean (948ms)  : 909, 986

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8480) - mean (100ms)  : 96, 103
    master - mean (100ms)  : 95, 104

    section Bailout
    This PR (8480) - mean (104ms)  : 99, 110
    master - mean (102ms)  : 97, 107

    section CallTarget+Inlining+NGEN
    This PR (8480) - mean (820ms)  : 784, 857
    master - mean (824ms)  : 787, 861

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8480) - mean (197ms)  : 191, 203
    master - mean (196ms)  : 191, 201

    section Bailout
    This PR (8480) - mean (200ms)  : 196, 204
    master - mean (200ms)  : 195, 206

    section CallTarget+Inlining+NGEN
    This PR (8480) - mean (1,189ms)  : 1142, 1237
    master - mean (1,192ms)  : 1156, 1229

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8480) - mean (282ms)  : 273, 291
    master - mean (286ms)  : 280, 291

    section Bailout
    This PR (8480) - mean (283ms)  : 277, 289
    master - mean (286ms)  : 279, 292

    section CallTarget+Inlining+NGEN
    This PR (8480) - mean (955ms)  : 937, 974
    master - mean (954ms)  : 928, 981

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8480) - mean (276ms)  : 270, 282
    master - mean (275ms)  : 268, 283

    section Bailout
    This PR (8480) - mean (276ms)  : 269, 282
    master - mean (275ms)  : 268, 283

    section CallTarget+Inlining+NGEN
    This PR (8480) - mean (1,153ms)  : 1113, 1193
    master - mean (1,150ms)  : 1111, 1189

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8480) - mean (274ms)  : 266, 281
    master - mean (275ms)  : 268, 282

    section Bailout
    This PR (8480) - mean (275ms)  : 269, 281
    master - mean (275ms)  : 269, 281

    section CallTarget+Inlining+NGEN
    This PR (8480) - mean (1,032ms)  : 1000, 1063
    master - mean (1,034ms)  : 994, 1073

Loading

@pr-commenter

pr-commenter Bot commented Apr 18, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-26 09:23:41

Comparing candidate commit 9b2dc20 in PR branch dudik/probes-global-rate-limit with baseline commit ee77554 in branch master.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 62 known flaky benchmarks, 64 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net472

  • 🟥 throughput [-7080.162op/s; -6830.080op/s] or [-8.083%; -7.797%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0

  • 🟩 throughput [+16884.368op/s; +22995.168op/s] or [+6.457%; +8.794%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-6768.949op/s; -6033.138op/s] or [-8.026%; -7.154%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-8762.541op/s; -7459.073op/s] or [-8.910%; -7.584%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+302.066ms; +308.307ms] or [+149.896%; +152.993%]
  • 🟥 throughput [-46.237op/s; -42.340op/s] or [-8.319%; -7.618%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+375.577ms; +379.276ms] or [+296.729%; +299.651%]
  • 🟩 throughput [+91.140op/s; +93.507op/s] or [+12.016%; +12.329%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+389.885ms; +393.841ms] or [+345.034%; +348.535%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.528%; +27.540%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.976%; +9.987%]
  • 🟩 execution_time [-15.529ms; -11.290ms] or [-7.253%; -5.273%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+27.500%; +27.510%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.743%; +105.758%]
  • 🟥 throughput [-274922.405op/s; -271307.807op/s] or [-28.071%; -27.702%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.557%; +38.566%]
  • 🟩 execution_time [-25.986ms; -19.154ms] or [-11.589%; -8.542%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.288%; +105.304%]
  • 🟥 throughput [-159037.550op/s; -143263.465op/s] or [-22.851%; -20.584%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟩 throughput [+8245.809op/s; +11217.725op/s] or [+5.247%; +7.138%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟩 throughput [+8441.816op/s; +11170.342op/s] or [+6.725%; +8.899%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+375737.197op/s; +503891.498op/s] or [+12.529%; +16.802%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-18.422ms; -14.085ms] or [-8.492%; -6.493%]
  • 🟩 throughput [+158289.007op/s; +211750.562op/s] or [+6.283%; +8.405%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟥 execution_time [+299.364ms; +300.056ms] or [+149.582%; +149.928%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟥 execution_time [+299.856ms; +303.302ms] or [+151.218%; +152.956%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟥 execution_time [+299.161ms; +301.566ms] or [+150.694%; +151.906%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+298.429ms; +299.133ms] or [+146.577%; +146.922%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+292.518ms; +294.367ms] or [+143.001%; +143.905%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+300.204ms; +302.200ms] or [+150.041%; +151.039%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟥 execution_time [+22.716µs; +46.362µs] or [+7.252%; +14.801%]
  • 🟥 throughput [-431.492op/s; -232.531op/s] or [-13.451%; -7.249%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.568ms; +300.310ms] or [+149.515%; +149.885%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • unstable execution_time [+339.872ms; +399.336ms] or [+369.285%; +433.895%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • unstable execution_time [+300.887ms; +351.485ms] or [+228.461%; +266.879%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+326.050ms; +372.051ms] or [+149.915%; +171.066%]
  • 🟥 throughput [-504.232op/s; -463.269op/s] or [-45.688%; -41.977%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+207.029ms; +340.334ms] or [+88.227%; +145.036%]
  • 🟥 throughput [-672.243op/s; -588.636op/s] or [-44.839%; -39.262%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+328.931ms; +336.832ms] or [+196.739%; +201.465%]
  • 🟥 throughput [-412.048op/s; -373.389op/s] or [-28.690%; -25.999%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0

  • 🟩 execution_time [-62.871µs; -55.820µs] or [-5.831%; -5.177%]
  • 🟩 throughput [+50.844op/s; +57.343op/s] or [+5.482%; +6.183%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+304.025ms; +305.524ms] or [+153.101%; +153.856%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 execution_time [+301.156ms; +303.476ms] or [+150.910%; +152.072%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 execution_time [+301.631ms; +305.647ms] or [+151.526%; +153.544%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+302.396ms; +304.290ms] or [+151.853%; +152.804%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 execution_time [+298.521ms; +301.328ms] or [+147.605%; +148.993%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 execution_time [+302.679ms; +306.153ms] or [+153.411%; +155.172%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+302.446ms; +304.916ms] or [+151.801%; +153.040%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 execution_time [+305.712ms; +310.234ms] or [+152.369%; +154.623%]
  • 🟩 throughput [+50540.061op/s; +56003.392op/s] or [+10.036%; +11.120%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 execution_time [+302.224ms; +305.654ms] or [+150.354%; +152.060%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟩 execution_time [-16.586ms; -12.881ms] or [-7.713%; -5.990%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+6.515µs; +52.344µs] or [+1.609%; +12.929%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-20.067KB; -20.044KB] or [-7.320%; -7.312%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟩 allocated_mem [-25.952KB; -25.935KB] or [-9.461%; -9.455%]
  • unstable execution_time [-70.902µs; -10.359µs] or [-12.287%; -1.795%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • unstable execution_time [+8.114µs; +13.641µs] or [+19.179%; +32.243%]
  • 🟥 throughput [-5656.016op/s; -3671.964op/s] or [-23.810%; -15.458%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-12.715µs; -4.215µs] or [-19.727%; -6.539%]
  • unstable throughput [+1052.470op/s; +2894.823op/s] or [+6.457%; +17.761%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+300.439ms; +302.069ms] or [+151.858%; +152.682%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+300.903ms; +303.279ms] or [+153.158%; +154.368%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+301.696ms; +305.178ms] or [+151.036%; +152.779%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟩 throughput [+31332.237op/s; +34142.652op/s] or [+5.931%; +6.462%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+298.030ms; +299.948ms] or [+148.541%; +149.497%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+302.046ms; +303.574ms] or [+151.673%; +152.441%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+301.466ms; +304.555ms] or [+152.884%; +154.451%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+300.211ms; +301.321ms] or [+149.747%; +150.301%]
  • 🟩 throughput [+61047138.463op/s; +61427361.962op/s] or [+44.458%; +44.735%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • unstable execution_time [+348.217ms; +405.755ms] or [+433.069%; +504.628%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+298.729ms; +300.001ms] or [+148.999%; +149.634%]
  • 🟩 throughput [+18355969.079op/s; +19344202.586op/s] or [+8.130%; +8.568%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟩 throughput [+105560.676op/s; +114373.860op/s] or [+9.856%; +10.679%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1

  • 🟩 throughput [+45260.503op/s; +64312.948op/s] or [+5.239%; +7.444%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟩 throughput [+93509.318op/s; +124274.385op/s] or [+7.238%; +9.619%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 throughput [+89095.412op/s; +97486.309op/s] or [+8.849%; +9.682%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0

  • 🟩 throughput [+49949.234op/s; +56781.602op/s] or [+9.070%; +10.311%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟩 throughput [+27422.171op/s; +37041.865op/s] or [+6.138%; +8.291%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟩 throughput [+96305.361op/s; +113834.037op/s] or [+10.760%; +12.718%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@dudikeleti
dudikeleti force-pushed the dudik/probes-global-rate-limit branch from caecce0 to bce4414 Compare May 20, 2026 11:02
@datadog-official

This comment has been minimized.

@dudikeleti
dudikeleti force-pushed the dudik/probes-global-rate-limit branch from bce4414 to b50b759 Compare May 20, 2026 16:46
@dudikeleti
dudikeleti requested a review from Copilot May 20, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@dudikeleti
dudikeleti force-pushed the dudik/probes-global-rate-limit branch from b50b759 to 5a3585a Compare May 22, 2026 10:55
@dudikeleti
dudikeleti marked this pull request as ready for review May 22, 2026 10:55
@dudikeleti
dudikeleti requested a review from a team as a code owner May 22, 2026 10:55
@dudikeleti
dudikeleti requested a review from Copilot May 22, 2026 10:55
@dudikeleti dudikeleti changed the title [Debugger] Add global rate limiter and clean up adaptive samplers [Debugger] Add global rate limiter May 22, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a3585af3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracer/src/Datadog.Trace/Debugger/Configurations/ConfigurationUpdater.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment on lines +121 to +122
return sampler.Sample()
&& (probeInfo.ProbeType != ProbeType.Snapshot || _globalRateLimiter.ShouldSampleSnapshot(probeInfo.ProbeId));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beware here on the order you invoke the samplers because you can have issues as the global will not be invoked as long as the per-probe returns true (short circuit of the condition). but once the sampler per-probe failed you start invoking the global one, but the total of sample starts at different point in time.

see the fix I made:
DataDog/dd-trace-java#5332

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it in this order to avoid a case where one probe with a lot of hits would affect another probe with only a single hit if we applied the global sampler first. Since the per-probe sampler already filters out some snapshots anyway, applying it first means the global sampler only sees snapshots that would actually be emitted in the end, which helps preserve fairness between probes.
But you’re right about the correctness of the global adaptive sampler. (I’m not sure what makes more sense from a product perspective). Thanks for pointing it out, fixed in b95673e

// Avoid ConcurrentDictionary.GetOrAdd(factory): its factory can run more than once
// under contention, leaking the losing sampler's Timer (rooted by the runtime).
if (_samplers.TryGetValue(probeId, out var sampler))
while (true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am concern that under high contention you make no progress on the thread, plus you are hammering the dict. will be good to have some backoff or a way to break this loop after a certain number of retries

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. In practice the loop bounded at ~2 iterations (only spins if ResetRate races for the same probeId), but you're right it's theoretically not bounded. Switched to GetOrAdd(key, value) to drop the loop entirely.
7180f83

@dudikeleti
dudikeleti force-pushed the dudik/probes-global-rate-limit branch 2 times, most recently from b95673e to 7180f83 Compare May 26, 2026 08:22
@dudikeleti
dudikeleti requested a review from a team as a code owner May 26, 2026 08:32
@dudikeleti
dudikeleti force-pushed the dudik/probes-global-rate-limit branch from 1a0e46c to 9b2dc20 Compare May 26, 2026 08:34
@dudikeleti
dudikeleti enabled auto-merge (squash) May 26, 2026 08:35

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just approving the nullability files, but took a glance at the other code, and I'd suggest removing implicit shared static state wherever you can, as it adds complexity, especially for testing

Comment on lines +46 to +52
internal static void TryDisposeInstance()
{
if (InstanceLazy.IsValueCreated)
{
InstanceLazy.Value.Dispose();
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my, what's going on here 😅 Disposal shouldn't be this complicated 🙈


namespace Datadog.Trace.Debugger.RateLimiting
{
internal interface IDebuggerGlobalRateLimiter : IDisposable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if you only have one implementation, you probably don't need an interface 🤷‍♂️ And if the reason you have an interface is because of the static state in your implementation, that's the root cause 😉

@dudikeleti
dudikeleti merged commit ec433e3 into master May 26, 2026
140 checks passed
@dudikeleti
dudikeleti deleted the dudik/probes-global-rate-limit branch May 26, 2026 10:00
@github-actions github-actions Bot added this to the vNext-v3 milestone May 26, 2026
@dudikeleti

Copy link
Copy Markdown
Contributor Author

Just approving the nullability files, but took a glance at the other code, and I'd suggest removing implicit shared static state wherever you can, as it adds complexity, especially for testing

Yes, it’s complicated because of existing code debt. The issue is the relationship between the global rate limiter, which is supposedly process-wide and the sharing across different debugger products, and the way ProbeProcessor uses it. I agree it’s ugly. I’ll open another PR soon to improve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants