Fix processing pipeline for client-side-stats#8436
Fix processing pipeline for client-side-stats#8436andrewlock wants to merge 7 commits intoandrew/client-side-stats/refactor-trace-chunk-modelfrom
Conversation
0b9d17e to
833ad62
Compare
d367d99 to
efd496f
Compare
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8436) 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 (8436) - mean (72ms) : 70, 74
master - mean (72ms) : 69, 75
section Bailout
This PR (8436) - mean (76ms) : 73, 78
master - mean (76ms) : 74, 78
section CallTarget+Inlining+NGEN
This PR (8436) - mean (1,068ms) : 1017, 1119
master - mean (1,071ms) : 1008, 1134
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 (8436) - mean (113ms) : 109, 116
master - mean (112ms) : 109, 115
section Bailout
This PR (8436) - mean (114ms) : 112, 117
master - mean (114ms) : 112, 117
section CallTarget+Inlining+NGEN
This PR (8436) - mean (780ms) : 758, 802
master - mean (776ms) : 756, 796
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8436) - mean (99ms) : 96, 103
master - mean (99ms) : 95, 103
section Bailout
This PR (8436) - mean (100ms) : 98, 103
master - mean (99ms) : 96, 101
section CallTarget+Inlining+NGEN
This PR (8436) - mean (933ms) : 898, 968
master - mean (927ms) : 893, 961
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8436) - mean (98ms) : 95, 101
master - mean (97ms) : 94, 100
section Bailout
This PR (8436) - mean (99ms) : 97, 101
master - mean (99ms) : 96, 101
section CallTarget+Inlining+NGEN
This PR (8436) - mean (818ms) : 775, 860
master - mean (811ms) : 783, 840
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 (8436) - mean (194ms) : 189, 198
master - mean (194ms) : 191, 197
section Bailout
This PR (8436) - mean (197ms) : 194, 199
master - mean (198ms) : 195, 200
section CallTarget+Inlining+NGEN
This PR (8436) - mean (1,152ms) : 1093, 1210
master - mean (1,155ms) : 1094, 1216
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 (8436) - mean (277ms) : 273, 281
master - mean (279ms) : 275, 283
section Bailout
This PR (8436) - mean (278ms) : 274, 281
master - mean (279ms) : 276, 282
section CallTarget+Inlining+NGEN
This PR (8436) - mean (929ms) : 910, 949
master - mean (927ms) : 905, 949
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8436) - mean (272ms) : 267, 278
master - mean (271ms) : 267, 275
section Bailout
This PR (8436) - mean (271ms) : 267, 274
master - mean (271ms) : 268, 273
section CallTarget+Inlining+NGEN
This PR (8436) - mean (1,141ms) : 1102, 1179
master - mean (1,142ms) : 1097, 1186
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8436) - mean (269ms) : 266, 272
master - mean (269ms) : 266, 273
section Bailout
This PR (8436) - mean (269ms) : 266, 272
master - mean (269ms) : 266, 273
section CallTarget+Inlining+NGEN
This PR (8436) - mean (1,026ms) : 991, 1061
master - mean (1,024ms) : 982, 1066
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
a99ae1b to
bf1d86f
Compare
BenchmarksBenchmark execution time: 2026-04-10 08:30:13 Comparing candidate commit bf1d86f in PR branch Found 27 performance improvements and 39 performance regressions! Performance is the same for 214 metrics, 8 unstable metrics.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3179a17d78
ℹ️ 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".
3179a17 to
2a9f4b3
Compare
efd496f to
bda5853
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a9f4b3577
ℹ️ 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".
| if (_statsAggregator.CanComputeStats == true) | ||
| { | ||
| await _statsAggregator.DisposeAsync().ConfigureAwait(false); | ||
| } |
There was a problem hiding this comment.
Always dispose stats aggregator during shutdown
FlushAndCloseAsync() now calls DisposeAsync() only when CanComputeStats == true, but a real StatsAggregator is instantiated whenever client-side stats are enabled, even while capability is still null/false (e.g., before discovery completes or when agent support is missing). In those cases shutdown skips disposal, so subscriptions are not removed and the internal flush task may continue running past writer shutdown, which leaks resources and can interfere with repeated tracer lifecycles/tests.
Useful? React with 👍 / 👎.
Summary of changes
Updates the processing pipeline for client side stats
Reason for change
The bulk of the CSS 1.2.0 work was done in #8420, but the span-processing pipeline wasn't the same as the Go agent:
ProcessTrace)ShouldKeepTrace)AddRange)Implementation details
The difference was mostly due to the way we had separate
ProcessTrace()andShouldKeepTrace()methods. By merging them, we can encapsulate the pipeline, and ensure that we mirror the way the Go agent processes traces.Additionally, there are two different mechanisms for dropping spans now - p0drops and "trace filtering", so added a new metric tag
reason:trace_filterfor it.Additionally, made some small optimizations:
ITraceProcessorwhen it only contains oneTraceFilteralgorithm to correctly look for local trace root, starting from last span_statsAggregatornon-null inAgentWriterto eliminate a bunch of null checksTest coverage
Covered by existing tests.
Other details
Part of a stack:
charhelpers likeIsAsciiHexDigit#8417IpAddressObfuscationUtilfor use with client-side-stats #8418ContainsSpanIdtoSpanCollection#8435