Remove sampling-based weighting in Client Side Stats#8828
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8828) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-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:
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 chartsFakeDbCommand (.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
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
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
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
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
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
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
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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BenchmarksBenchmark execution time: 2026-06-25 08:49:19 Comparing candidate commit 16f435b in PR branch 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.
|
There was a problem hiding this comment.
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 tolong. - 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.
|
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) |
… 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]>
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_ratetag (which .NET never implemented), not the normal sampling rate. Therefore this weighting causes overcounting.Implementation details
longsTest coverage
GetWeight()behavior