Skip to content

Remove sampling-based weighting in Client Side Stats#8828

Merged
andrewlock merged 1 commit into
masterfrom
andrew/fix-stats-weight
Jun 25, 2026
Merged

Remove sampling-based weighting in Client Side Stats#8828
andrewlock merged 1 commit into
masterfrom
andrew/fix-stats-weight

Conversation

@andrewlock

Copy link
Copy Markdown
Member

Summary of changes

Removes the incorrect sampling-based weighting from Client-Side stats

Reason for change

When implementing the updated CSS implementation in #8420, we compared with the canonicial Go implementation, and added a GetWeight() method based on this. However, the sampling rate that this is based on is based on the deprecated _sample_rate tag (which .NET never implemented), not the normal sampling rate. Therefore this weighting causes overcounting.

Implementation details

  • Rip out GetWeight() and associated usages
  • Revert various doubles back to longs
  • Remove the unnecessary stochastic rounding

Test coverage

  • Removed one test for GetWeight() behavior
  • TBC a system test that would catch this - serverless e2e tests (thanks @apiarian-datadog!) caught this one

@dd-trace-dotnet-ci-bot

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8828) 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
duration70.14 ± (70.16 - 70.46) ms70.08 ± (70.03 - 70.30) ms-0.1%
.NET Framework 4.8 - Bailout
duration76.80 ± (76.58 - 77.06) ms74.27 ± (74.22 - 74.57) ms-3.3%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1076.09 ± (1076.29 - 1081.80) ms1076.73 ± (1077.79 - 1084.55) ms+0.1%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.00 ± (21.97 - 22.03) ms22.11 ± (22.07 - 22.14) ms+0.5%✅⬆️
process.time_to_main_ms80.89 ± (80.73 - 81.06) ms80.95 ± (80.78 - 81.12) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.95 ± (10.95 - 10.96) MB10.93 ± (10.93 - 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.29 ± (22.24 - 22.33) ms22.07 ± (22.05 - 22.10) ms-1.0%
process.time_to_main_ms85.29 ± (85.00 - 85.59) ms82.14 ± (81.99 - 82.30) ms-3.7%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.98 ± (10.98 - 10.99) MB10.97 ± (10.97 - 10.98) MB-0.1%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms209.45 ± (208.52 - 210.37) ms211.39 ± (210.69 - 212.09) ms+0.9%✅⬆️
process.time_to_main_ms528.71 ± (527.60 - 529.82) ms531.15 ± (529.80 - 532.51) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.78 ± (48.75 - 48.82) MB48.73 ± (48.69 - 48.76) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.2%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.00 ± (20.96 - 21.05) ms20.97 ± (20.93 - 21.02) ms-0.1%
process.time_to_main_ms72.14 ± (71.89 - 72.39) ms71.73 ± (71.53 - 71.94) ms-0.6%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.65 ± (10.64 - 10.65) MB10.63 ± (10.63 - 10.63) MB-0.2%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms20.72 ± (20.70 - 20.75) ms20.75 ± (20.73 - 20.78) ms+0.1%✅⬆️
process.time_to_main_ms71.27 ± (71.17 - 71.36) ms71.17 ± (71.08 - 71.26) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.76 ± (10.75 - 10.76) MB10.75 ± (10.74 - 10.75) MB-0.1%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms370.53 ± (368.24 - 372.83) ms373.50 ± (370.96 - 376.04) ms+0.8%✅⬆️
process.time_to_main_ms535.20 ± (534.11 - 536.30) ms533.91 ± (532.63 - 535.19) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed50.22 ± (50.20 - 50.24) MB50.17 ± (50.14 - 50.20) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.3%
.NET 8 - Baseline
process.internal_duration_ms19.01 ± (18.98 - 19.04) ms19.07 ± (19.05 - 19.10) ms+0.3%✅⬆️
process.time_to_main_ms68.97 ± (68.84 - 69.10) ms68.81 ± (68.68 - 68.94) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.66 - 7.67) MB7.68 ± (7.67 - 7.69) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.20 ± (19.16 - 19.24) ms19.29 ± (19.25 - 19.33) ms+0.4%✅⬆️
process.time_to_main_ms72.10 ± (71.84 - 72.36) ms72.47 ± (72.25 - 72.69) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.72) MB7.73 ± (7.72 - 7.73) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms298.12 ± (296.03 - 300.21) ms298.16 ± (296.28 - 300.04) ms+0.0%✅⬆️
process.time_to_main_ms482.42 ± (481.44 - 483.39) ms483.75 ± (482.84 - 484.67) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed37.15 ± (37.12 - 37.18) MB37.19 ± (37.16 - 37.21) MB+0.1%✅⬆️
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
duration200.88 ± (200.57 - 201.53) ms202.53 ± (202.30 - 203.24) ms+0.8%✅⬆️
.NET Framework 4.8 - Bailout
duration205.09 ± (204.64 - 205.45) ms206.77 ± (205.94 - 206.99) ms+0.8%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1207.24 ± (1206.60 - 1212.33) ms1213.02 ± (1212.61 - 1218.50) ms+0.5%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms195.43 ± (195.10 - 195.76) ms195.95 ± (195.61 - 196.30) ms+0.3%✅⬆️
process.time_to_main_ms84.97 ± (84.74 - 85.20) ms85.30 ± (85.06 - 85.55) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.05 ± (16.02 - 16.07) MB16.01 ± (15.98 - 16.03) MB-0.2%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.2%
.NET Core 3.1 - Bailout
process.internal_duration_ms193.05 ± (192.74 - 193.36) ms196.95 ± (196.54 - 197.36) ms+2.0%✅⬆️
process.time_to_main_ms85.20 ± (84.96 - 85.43) ms86.75 ± (86.45 - 87.05) ms+1.8%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.07 ± (16.04 - 16.10) MB16.11 ± (16.09 - 16.14) MB+0.3%✅⬆️
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)-0.7%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms387.87 ± (386.73 - 389.01) ms389.61 ± (388.03 - 391.20) ms+0.4%✅⬆️
process.time_to_main_ms541.80 ± (540.51 - 543.09) ms544.54 ± (543.38 - 545.70) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.84 ± (57.62 - 58.06) MB58.24 ± (58.01 - 58.47) MB+0.7%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)-0.0%
.NET 6 - Baseline
process.internal_duration_ms200.25 ± (199.78 - 200.72) ms201.38 ± (200.92 - 201.84) ms+0.6%✅⬆️
process.time_to_main_ms73.30 ± (73.05 - 73.56) ms74.50 ± (74.26 - 74.75) ms+1.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.34 ± (16.32 - 16.37) MB16.33 ± (16.31 - 16.36) MB-0.1%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.4%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms198.78 ± (198.42 - 199.14) ms200.61 ± (200.14 - 201.08) ms+0.9%✅⬆️
process.time_to_main_ms74.33 ± (74.14 - 74.52) ms75.40 ± (75.10 - 75.69) ms+1.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.41 ± (16.38 - 16.43) MB16.42 ± (16.39 - 16.45) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.3%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms582.98 ± (580.62 - 585.34) ms581.23 ± (578.38 - 584.08) ms-0.3%
process.time_to_main_ms550.62 ± (549.54 - 551.69) ms556.16 ± (554.95 - 557.38) ms+1.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.18 ± (61.10 - 61.26) MB61.33 ± (61.24 - 61.41) MB+0.2%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)-0.6%
.NET 8 - Baseline
process.internal_duration_ms197.80 ± (197.45 - 198.15) ms199.15 ± (198.72 - 199.59) ms+0.7%✅⬆️
process.time_to_main_ms72.87 ± (72.66 - 73.09) ms73.58 ± (73.36 - 73.80) ms+1.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.66 ± (11.64 - 11.68) MB11.72 ± (11.70 - 11.74) MB+0.5%✅⬆️
runtime.dotnet.threads.count19 ± (18 - 19)18 ± (18 - 18)-1.5%
.NET 8 - Bailout
process.internal_duration_ms197.07 ± (196.57 - 197.57) ms199.49 ± (199.13 - 199.85) ms+1.2%✅⬆️
process.time_to_main_ms73.70 ± (73.49 - 73.92) ms74.71 ± (74.46 - 74.97) ms+1.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.75 ± (11.73 - 11.78) MB11.77 ± (11.74 - 11.79) MB+0.1%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.1%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms512.01 ± (509.49 - 514.52) ms514.19 ± (511.08 - 517.31) ms+0.4%✅⬆️
process.time_to_main_ms500.83 ± (499.90 - 501.76) ms503.06 ± (502.23 - 503.89) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.86 ± (50.82 - 50.89) MB50.95 ± (50.91 - 50.99) MB+0.2%✅⬆️
runtime.dotnet.threads.count30 ± (29 - 30)30 ± (30 - 30)+0.7%✅⬆️
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 (8828) - mean (70ms)  : 68, 72
    master - mean (70ms)  : 68, 73

    section Bailout
    This PR (8828) - mean (74ms)  : 73, 76
    master - mean (77ms)  : 73, 80

    section CallTarget+Inlining+NGEN
    This PR (8828) - mean (1,081ms)  : 1033, 1129
    master - mean (1,079ms)  : 1040, 1119

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 (8828) - mean (110ms)  : 106, 113
    master - mean (109ms)  : 107, 112

    section Bailout
    This PR (8828) - mean (111ms)  : 108, 113
    master - mean (115ms)  : 109, 121

    section CallTarget+Inlining+NGEN
    This PR (8828) - mean (779ms)  : 753, 806
    master - mean (774ms)  : 749, 799

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8828) - mean (99ms)  : 94, 105
    master - mean (100ms)  : 94, 106

    section Bailout
    This PR (8828) - mean (98ms)  : 96, 99
    master - mean (98ms)  : 96, 100

    section CallTarget+Inlining+NGEN
    This PR (8828) - mean (935ms)  : 894, 976
    master - mean (934ms)  : 895, 973

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8828) - mean (94ms)  : 91, 97
    master - mean (94ms)  : 92, 97

    section Bailout
    This PR (8828) - mean (99ms)  : 94, 104
    master - mean (99ms)  : 92, 105

    section CallTarget+Inlining+NGEN
    This PR (8828) - mean (811ms)  : 778, 844
    master - mean (812ms)  : 771, 853

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 (8828) - mean (203ms)  : 197, 208
    master - mean (201ms)  : 196, 206

    section Bailout
    This PR (8828) - mean (206ms)  : 201, 212
    master - mean (205ms)  : 201, 209

    section CallTarget+Inlining+NGEN
    This PR (8828) - mean (1,216ms)  : 1174, 1257
    master - mean (1,209ms)  : 1168, 1250

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 (8828) - mean (291ms)  : 286, 296
    master - mean (290ms)  : 286, 295

    section Bailout
    This PR (8828) - mean (294ms)  : 288, 300
    master - mean (288ms)  : 284, 293

    section CallTarget+Inlining+NGEN
    This PR (8828) - mean (974ms)  : 949, 999
    master - mean (972ms)  : 948, 997

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8828) - mean (285ms)  : 278, 292
    master - mean (282ms)  : 277, 288

    section Bailout
    This PR (8828) - mean (285ms)  : 279, 292
    master - mean (282ms)  : 278, 287

    section CallTarget+Inlining+NGEN
    This PR (8828) - mean (1,168ms)  : 1131, 1204
    master - mean (1,164ms)  : 1128, 1199

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8828) - mean (283ms)  : 277, 289
    master - mean (280ms)  : 276, 285

    section Bailout
    This PR (8828) - mean (285ms)  : 280, 290
    master - mean (281ms)  : 274, 288

    section CallTarget+Inlining+NGEN
    This PR (8828) - mean (1,049ms)  : 1003, 1095
    master - mean (1,046ms)  : 1011, 1081

Loading

@pr-commenter

pr-commenter Bot commented Jun 25, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-06-25 08:49:19

Comparing candidate commit 16f435b in PR branch andrew/fix-stats-weight with baseline commit d5dd09f in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 59 known flaky benchmarks, 67 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 [-4975.462op/s; -4439.299op/s] or [-5.680%; -5.068%]

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.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-7757.683op/s; -7276.005op/s] or [-9.198%; -8.627%]

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

  • 🟥 throughput [-7232.581op/s; -5724.203op/s] or [-7.354%; -5.820%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+299.525ms; +301.248ms] or [+148.635%; +149.490%]
  • 🟥 throughput [-47.578op/s; -43.896op/s] or [-8.560%; -7.898%]

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

  • 🟥 execution_time [+382.013ms; +385.277ms] or [+301.814%; +304.393%]
  • 🟩 throughput [+78.326op/s; +85.734op/s] or [+10.327%; +11.304%]

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

  • 🟥 execution_time [+387.392ms; +388.329ms] or [+342.828%; +343.656%]

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.476ms; -11.295ms] or [-7.228%; -5.275%]

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 [-276586.429op/s; -272790.521op/s] or [-28.241%; -27.853%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.557%; +38.566%]
  • 🟩 execution_time [-26.780ms; -21.926ms] or [-11.943%; -9.778%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.288%; +105.304%]
  • 🟥 throughput [-154462.192op/s; -138539.578op/s] or [-22.193%; -19.905%]

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

  • 🟩 throughput [+9443.484op/s; +12381.733op/s] or [+6.009%; +7.878%]

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

  • 🟩 throughput [+9922.150op/s; +12609.056op/s] or [+7.904%; +10.045%]

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

  • 🟩 throughput [+497658.453op/s; +535125.345op/s] or [+16.594%; +17.843%]

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

  • 🟩 execution_time [-19.661ms; -15.294ms] or [-9.063%; -7.050%]
  • 🟩 throughput [+181001.320op/s; +235266.095op/s] or [+7.184%; +9.338%]

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

  • 🟥 execution_time [+300.218ms; +301.012ms] or [+150.009%; +150.406%]

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

  • 🟥 execution_time [+300.595ms; +304.158ms] or [+151.591%; +153.388%]

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

  • 🟥 execution_time [+299.746ms; +302.944ms] or [+150.989%; +152.600%]

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

  • 🟥 execution_time [+296.499ms; +297.656ms] or [+145.629%; +146.197%]

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

  • 🟥 execution_time [+292.264ms; +295.376ms] or [+142.877%; +144.399%]

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

  • 🟥 execution_time [+300.291ms; +302.284ms] or [+150.085%; +151.081%]

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

  • 🟥 execution_time [+21.010µs; +44.631µs] or [+6.707%; +14.249%]
  • 🟥 throughput [-417.207op/s; -218.434op/s] or [-13.006%; -6.809%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.601ms; +300.350ms] or [+149.532%; +149.905%]

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

  • unstable execution_time [+315.576ms; +381.958ms] or [+342.887%; +415.013%]
  • 🟩 throughput [+736.958op/s; +966.371op/s] or [+6.056%; +7.941%]

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

  • unstable execution_time [+203.826ms; +268.428ms] or [+154.763%; +203.815%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+338.562ms; +397.385ms] or [+155.668%; +182.714%]
  • 🟥 throughput [-517.676op/s; -467.355op/s] or [-46.907%; -42.347%]

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

  • unstable execution_time [+202.483ms; +335.754ms] or [+86.290%; +143.084%]
  • 🟥 throughput [-677.364op/s; -593.515op/s] or [-45.180%; -39.588%]

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

  • 🟥 execution_time [+323.551ms; +336.206ms] or [+193.521%; +201.090%]
  • 🟥 throughput [-417.668op/s; -380.264op/s] or [-29.082%; -26.477%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • unstable throughput [+16.080op/s; +52.212op/s] or [+4.622%; +15.008%]

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

  • 🟩 execution_time [-172.883µs; -112.651µs] or [-8.758%; -5.706%]
  • 🟩 throughput [+33.199op/s; +49.099op/s] or [+6.554%; +9.693%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+302.535ms; +303.980ms] or [+152.351%; +153.079%]

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

  • 🟥 execution_time [+299.508ms; +300.886ms] or [+150.084%; +150.774%]

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

  • 🟥 execution_time [+300.390ms; +303.895ms] or [+150.903%; +152.664%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+300.768ms; +303.098ms] or [+151.036%; +152.206%]
  • 🟩 throughput [+15529.117op/s; +17744.574op/s] or [+5.203%; +5.945%]

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

  • 🟥 execution_time [+298.069ms; +299.746ms] or [+147.382%; +148.211%]

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

  • 🟥 execution_time [+303.564ms; +307.339ms] or [+153.860%; +155.773%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+301.676ms; +304.304ms] or [+151.414%; +152.733%]

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

  • 🟥 execution_time [+299.148ms; +301.338ms] or [+149.098%; +150.189%]
  • 🟩 throughput [+49363.676op/s; +53072.820op/s] or [+9.802%; +10.539%]

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

  • 🟥 execution_time [+301.594ms; +304.122ms] or [+150.040%; +151.298%]

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

  • 🟩 execution_time [-17.513ms; -13.851ms] or [-8.143%; -6.441%]
  • 🟩 throughput [+19726.329op/s; +27226.934op/s] or [+5.411%; +7.469%]

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

  • unstable execution_time [+9.326µs; +52.940µs] or [+2.304%; +13.077%]

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

  • 🟩 allocated_mem [-25.034KB; -25.011KB] or [-9.132%; -9.123%]
  • unstable execution_time [-21.606µs; +35.633µs] or [-4.270%; +7.043%]

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

  • unstable execution_time [-29.986µs; +33.109µs] or [-5.196%; +5.738%]

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

  • unstable execution_time [+6.054µs; +10.453µs] or [+14.309%; +24.707%]
  • 🟥 throughput [-4746.283op/s; -2906.517op/s] or [-19.980%; -12.236%]

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

  • unstable execution_time [-14.056µs; -6.418µs] or [-21.807%; -9.958%]
  • 🟩 throughput [+1569.528op/s; +3195.494op/s] or [+9.630%; +19.605%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.083ms; +302.526ms] or [+152.184%; +152.914%]

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

  • 🟥 execution_time [+302.205ms; +304.671ms] or [+153.822%; +155.077%]

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

  • 🟥 execution_time [+299.183ms; +301.178ms] or [+149.778%; +150.777%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+298.624ms; +300.610ms] or [+148.837%; +149.827%]

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

  • 🟥 execution_time [+300.641ms; +303.012ms] or [+150.968%; +152.158%]

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

  • 🟥 execution_time [+303.435ms; +305.653ms] or [+153.883%; +155.007%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.488ms; +300.534ms] or [+149.386%; +149.908%]
  • 🟩 throughput [+61350383.273op/s; +61681719.681op/s] or [+44.679%; +44.920%]

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

  • 🟥 execution_time [+420.255ms; +425.067ms] or [+522.662%; +528.646%]

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

  • 🟥 execution_time [+298.621ms; +299.702ms] or [+148.945%; +149.484%]

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

  • 🟩 throughput [+71470.154op/s; +108423.806op/s] or [+6.673%; +10.123%]

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

  • 🟩 throughput [+49344.417op/s; +69450.390op/s] or [+5.712%; +8.039%]

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

  • 🟩 throughput [+75362.859op/s; +84464.709op/s] or [+7.485%; +8.389%]

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

  • 🟩 throughput [+50368.538op/s; +55324.324op/s] or [+9.146%; +10.046%]

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

  • 🟩 throughput [+77816.409op/s; +96075.416op/s] or [+8.694%; +10.734%]

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 net6.0
  • 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.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • 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 net6.0
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

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.

Pull request overview

Removes sampling-rate-based weighting from the Client-Side Stats (CSS) implementation in the .NET tracer, aligning behavior with the fact that the relevant _sample_rate tag is deprecated/not implemented and the previous weighting caused overcounting.

Changes:

  • Removed sampling-based weighting logic (GetWeight) from stats aggregation and reverted bucket counters back to long.
  • Removed stochastic rounding and now serializes bucket counters/duration directly as int64.
  • Updated/removed the unit test that previously asserted sampling-weight behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tracer/test/Datadog.Trace.Tests/Agent/StatsAggregatorTests.cs Removes the old sampling-weight test and updates helper docs; should add a regression test for the new unweighted behavior.
tracer/src/Datadog.Trace/Agent/StatsBuffer.cs Removes stochastic rounding and writes bucket values directly as int64 in msgpack.
tracer/src/Datadog.Trace/Agent/StatsBucket.cs Changes bucket counters/duration from double back to long.
tracer/src/Datadog.Trace/Agent/StatsAggregator.cs Removes GetWeight() and updates aggregation to increment counters and sum duration without weighting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tracer/test/Datadog.Trace.Tests/Agent/StatsAggregatorTests.cs
@apiarian-datadog

Copy link
Copy Markdown

confirmed that this patch fixes the serverless-init e2e tests with sampling enabled (the tests passed with 100% sampling and continue to do so, still)

@andrewlock
andrewlock merged commit 51ca7e7 into master Jun 25, 2026
145 checks passed
@andrewlock
andrewlock deleted the andrew/fix-stats-weight branch June 25, 2026 21:31
@github-actions github-actions Bot added this to the vNext-v3 milestone Jun 25, 2026
mabdinur added a commit that referenced this pull request Jul 9, 2026
… sentinel

- Remove GetWeight and revert to unweighted Hits/Errors/Duration/TopLevelHits,
  aligning with the intentional removal in PR #8828
- Revert StatsBucket fields back to long (no fractional weights needed)
- Remove (long) casts in StatsBuffer now that fields are long again
- Fix MaxDuration sentinel: use long.MinValue instead of 0 so zero-duration
  spans are correctly recorded and emitted
- Remove (long) cast on bucket.Duration in serializer (field is long again)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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