Fix race condition in Client Side Stats enablement#8509
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b5cd08520
ℹ️ 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".
BenchmarksBenchmark execution time: 2026-04-28 16:27:27 Comparing candidate commit 7a0764e in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 0 unstable metrics, 59 known flaky benchmarks, 28 flaky benchmarks without significant changes.
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8509) 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 (8509) - mean (73ms) : 71, 76
master - mean (75ms) : 71, 80
section Bailout
This PR (8509) - mean (80ms) : 76, 84
master - mean (78ms) : 75, 81
section CallTarget+Inlining+NGEN
This PR (8509) - mean (1,085ms) : 1021, 1149
master - mean (1,075ms) : 1026, 1124
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 (8509) - mean (116ms) : 109, 123
master - mean (117ms) : 111, 122
section Bailout
This PR (8509) - mean (117ms) : 112, 122
master - mean (114ms) : 110, 118
section CallTarget+Inlining+NGEN
This PR (8509) - mean (773ms) : 749, 798
master - mean (776ms) : 747, 805
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8509) - mean (105ms) : 99, 111
master - mean (101ms) : 96, 107
section Bailout
This PR (8509) - mean (102ms) : 99, 106
master - mean (106ms) : 100, 111
section CallTarget+Inlining+NGEN
This PR (8509) - mean (939ms) : 902, 976
master - mean (942ms) : 911, 973
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8509) - mean (102ms) : 96, 108
master - mean (100ms) : 97, 103
section Bailout
This PR (8509) - mean (105ms) : 101, 110
master - mean (103ms) : 98, 109
section CallTarget+Inlining+NGEN
This PR (8509) - mean (823ms) : 786, 861
master - mean (823ms) : 790, 857
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 (8509) - mean (207ms) : 198, 216
master - mean (200ms) : 194, 206
section Bailout
This PR (8509) - mean (212ms) : 199, 224
master - mean (204ms) : 198, 209
section CallTarget+Inlining+NGEN
This PR (8509) - mean (1,217ms) : 1156, 1278
master - mean (1,181ms) : 1122, 1240
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 (8509) - mean (297ms) : 283, 311
master - mean (287ms) : 275, 298
section Bailout
This PR (8509) - mean (297ms) : 282, 312
master - mean (286ms) : 277, 295
section CallTarget+Inlining+NGEN
This PR (8509) - mean (970ms) : 937, 1002
master - mean (932ms) : 910, 954
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8509) - mean (292ms) : 276, 308
master - mean (279ms) : 269, 289
section Bailout
This PR (8509) - mean (290ms) : 276, 303
master - mean (281ms) : 270, 292
section CallTarget+Inlining+NGEN
This PR (8509) - mean (1,165ms) : 1121, 1209
master - mean (1,143ms) : 1084, 1201
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8509) - mean (288ms) : 273, 304
master - mean (278ms) : 270, 286
section Bailout
This PR (8509) - mean (289ms) : 276, 302
master - mean (279ms) : 271, 288
section CallTarget+Inlining+NGEN
This PR (8509) - mean (1,057ms) : 983, 1130
master - mean (1,035ms) : 993, 1077
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Co-authored-by: Andrew Lock <[email protected]>
Summary of changes
Fixes a race condition in client-side-stats enablement
Reason for change
A unit test was flaking, where there was a delay in obfuscation, so we had 2 buckets - one with obfuscated resource name, and one without.
Implementation details
Move the setting of
CanComputeStats = trueto the end of the method, after setting peer tags and obfuscation, so that when it switchesfalse->true, it already has the full config.Warning
There is still a race condition when config is updated for an already enabled stats config. In that case the obfuscation/peer tags will be briefly out of sync theoretically. But I don't think that's a big issue, and would only occur if the agent changes during application execution, which is rare
Test coverage
Covered by the unit tests already (they shouldn't flake now).
Other details