Fix usages of new Tracer() which are never cleaned up#7938
Merged
andrewlock merged 1 commit intomasterfrom Dec 10, 2025
Merged
Conversation
d793317 to
e96d8b3
Compare
BenchmarksBenchmarks Report for benchmark platform 🐌Benchmarks for #7938 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ More allocations
|
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 | 5.92 KB | 6.01 KB | 94 B | 1.59% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartStopWithChild |
net6.0 | 11.2μs | 43.8ns | 169ns | 0 | 0 | 0 | 5.49 KB |
| master | StartStopWithChild |
netcoreapp3.1 | 13.5μs | 71.2ns | 356ns | 0 | 0 | 0 | 5.71 KB |
| master | StartStopWithChild |
net472 | 22.3μs | 124ns | 756ns | 0.97 | 0.323 | 0.108 | 5.92 KB |
| #7938 | StartStopWithChild |
net6.0 | 11.1μs | 54.1ns | 230ns | 0 | 0 | 0 | 5.5 KB |
| #7938 | StartStopWithChild |
netcoreapp3.1 | 13.6μs | 70.1ns | 343ns | 0 | 0 | 0 | 5.71 KB |
| #7938 | StartStopWithChild |
net472 | 22.2μs | 115ns | 537ns | 0.879 | 0.33 | 0 | 6.01 KB |
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 1.29ms | 381ns | 1.47μs | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.38ms | 368ns | 1.42μs | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 1.74ms | 2.76μs | 10.7μs | 0 | 0 | 0 | 3.26 KB |
| #7938 | WriteAndFlushEnrichedTraces |
net6.0 | 1.25ms | 79.8ns | 299ns | 0 | 0 | 0 | 2.7 KB |
| #7938 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.41ms | 2.78μs | 10.8μs | 0 | 0 | 0 | 2.7 KB |
| #7938 | WriteAndFlushEnrichedTraces |
net472 | 1.73ms | 324ns | 1.21μs | 0 | 0 | 0 | 3.26 KB |
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | AllCycleSimpleBody |
net6.0 | 1.08μs | 6.11ns | 41.4ns | 0 | 0 | 0 | 1.22 KB |
| master | AllCycleSimpleBody |
netcoreapp3.1 | 1.38μs | 7.72ns | 48.8ns | 0 | 0 | 0 | 1.2 KB |
| master | AllCycleSimpleBody |
net472 | 1.01μs | 0.769ns | 2.98ns | 0.191 | 0 | 0 | 1.23 KB |
| master | AllCycleMoreComplexBody |
net6.0 | 7.41μs | 33.4ns | 129ns | 0 | 0 | 0 | 4.72 KB |
| master | AllCycleMoreComplexBody |
netcoreapp3.1 | 8.87μs | 47.1ns | 231ns | 0 | 0 | 0 | 4.62 KB |
| master | AllCycleMoreComplexBody |
net472 | 8.36μs | 13.5ns | 50.7ns | 0.752 | 0 | 0 | 4.74 KB |
| master | ObjectExtractorSimpleBody |
net6.0 | 333ns | 0.197ns | 0.765ns | 0 | 0 | 0 | 280 B |
| master | ObjectExtractorSimpleBody |
netcoreapp3.1 | 392ns | 2.13ns | 12ns | 0 | 0 | 0 | 272 B |
| master | ObjectExtractorSimpleBody |
net472 | 309ns | 0.0176ns | 0.0682ns | 0.0436 | 0 | 0 | 281 B |
| master | ObjectExtractorMoreComplexBody |
net6.0 | 6.52μs | 33.9ns | 163ns | 0 | 0 | 0 | 3.78 KB |
| master | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.82μs | 38.1ns | 157ns | 0 | 0 | 0 | 3.69 KB |
| master | ObjectExtractorMoreComplexBody |
net472 | 6.69μs | 1.42ns | 5.48ns | 0.572 | 0 | 0 | 3.8 KB |
| #7938 | AllCycleSimpleBody |
net6.0 | 1.11μs | 6.1ns | 38.1ns | 0 | 0 | 0 | 1.22 KB |
| #7938 | AllCycleSimpleBody |
netcoreapp3.1 | 1.4μs | 5.96ns | 28.6ns | 0 | 0 | 0 | 1.2 KB |
| #7938 | AllCycleSimpleBody |
net472 | 1.04μs | 0.948ns | 3.67ns | 0.191 | 0 | 0 | 1.23 KB |
| #7938 | AllCycleMoreComplexBody |
net6.0 | 7.43μs | 39ns | 199ns | 0 | 0 | 0 | 4.72 KB |
| #7938 | AllCycleMoreComplexBody |
netcoreapp3.1 | 8.99μs | 45.5ns | 209ns | 0 | 0 | 0 | 4.62 KB |
| #7938 | AllCycleMoreComplexBody |
net472 | 7.64μs | 4.58ns | 17.7ns | 0.726 | 0 | 0 | 4.74 KB |
| #7938 | ObjectExtractorSimpleBody |
net6.0 | 342ns | 1.63ns | 6.31ns | 0 | 0 | 0 | 280 B |
| #7938 | ObjectExtractorSimpleBody |
netcoreapp3.1 | 392ns | 2.17ns | 13.2ns | 0 | 0 | 0 | 272 B |
| #7938 | ObjectExtractorSimpleBody |
net472 | 306ns | 0.153ns | 0.573ns | 0.0431 | 0 | 0 | 281 B |
| #7938 | ObjectExtractorMoreComplexBody |
net6.0 | 6.55μs | 2.75ns | 9.9ns | 0 | 0 | 0 | 3.78 KB |
| #7938 | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.95μs | 23.7ns | 92ns | 0 | 0 | 0 | 3.69 KB |
| #7938 | ObjectExtractorMoreComplexBody |
net472 | 6.69μs | 2.07ns | 7.48ns | 0.603 | 0 | 0 | 3.8 KB |
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EncodeArgs |
net6.0 | 76.8μs | 245ns | 883ns | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
netcoreapp3.1 | 97.5μs | 233ns | 872ns | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
net472 | 109μs | 11.2ns | 43.2ns | 4.9 | 0 | 0 | 32.5 KB |
| master | EncodeLegacyArgs |
net6.0 | 148μs | 33ns | 128ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
netcoreapp3.1 | 200μs | 209ns | 808ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
net472 | 264μs | 40.4ns | 157ns | 0 | 0 | 0 | 2.14 KB |
| #7938 | EncodeArgs |
net6.0 | 76.9μs | 74.8ns | 280ns | 0 | 0 | 0 | 32.4 KB |
| #7938 | EncodeArgs |
netcoreapp3.1 | 97.8μs | 309ns | 1.16μs | 0 | 0 | 0 | 32.4 KB |
| #7938 | EncodeArgs |
net472 | 108μs | 13.6ns | 50.9ns | 4.88 | 0 | 0 | 32.5 KB |
| #7938 | EncodeLegacyArgs |
net6.0 | 147μs | 54.7ns | 212ns | 0 | 0 | 0 | 2.14 KB |
| #7938 | EncodeLegacyArgs |
netcoreapp3.1 | 200μs | 122ns | 471ns | 0 | 0 | 0 | 2.14 KB |
| #7938 | EncodeLegacyArgs |
net472 | 265μs | 30.8ns | 119ns | 0 | 0 | 0 | 2.14 KB |
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunWafRealisticBenchmark |
net6.0 | 422μs | 1.33μs | 4.62μs | 0 | 0 | 0 | 4.55 KB |
| master | RunWafRealisticBenchmark |
netcoreapp3.1 | 448μs | 2.1μs | 7.86μs | 0 | 0 | 0 | 4.48 KB |
| master | RunWafRealisticBenchmark |
net472 | 496μs | 389ns | 1.46μs | 0 | 0 | 0 | 0 b |
| master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 308μs | 1.45μs | 5.61μs | 0 | 0 | 0 | 2.24 KB |
| master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 335μs | 1.44μs | 5.19μs | 0 | 0 | 0 | 2.22 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net472 | 363μs | 650ns | 2.52μs | 0 | 0 | 0 | 0 b |
| #7938 | RunWafRealisticBenchmark |
net6.0 | 415μs | 902ns | 3.38μs | 0 | 0 | 0 | 4.55 KB |
| #7938 | RunWafRealisticBenchmark |
netcoreapp3.1 | 457μs | 2.67μs | 24.7μs | 0 | 0 | 0 | 4.48 KB |
| #7938 | RunWafRealisticBenchmark |
net472 | 492μs | 554ns | 2μs | 0 | 0 | 0 | 0 b |
| #7938 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 304μs | 1.21μs | 4.54μs | 0 | 0 | 0 | 2.24 KB |
| #7938 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 327μs | 1.43μs | 4.94μs | 0 | 0 | 0 | 2.22 KB |
| #7938 | RunWafRealisticBenchmarkWithAttack |
net472 | 361μs | 211ns | 731ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.AspNetCoreBenchmark - Unknown 🤷 Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendRequest |
net6.0 | 84.2μs | 245ns | 883ns | 0 | 0 | 0 | 18.97 KB |
| master | SendRequest |
netcoreapp3.1 | 96.6μs | 306ns | 1.78μs | 0 | 0 | 0 | 21.18 KB |
| master | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
| #7938 | SendRequest |
net6.0 | 84.6μs | 311ns | 1.35μs | 0 | 0 | 0 | 18.98 KB |
| #7938 | SendRequest |
netcoreapp3.1 | 96.4μs | 308ns | 1.38μs | 0 | 0 | 0 | 21.18 KB |
| #7938 | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CharSliceBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #7938
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1
2.291
1,886,300.00
823,500.00
Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice‑netcoreapp3.1
1.858
3,906,550.00
2,103,050.00
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 | 2.291 | 1,886,300.00 | 823,500.00 | |
| Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice‑netcoreapp3.1 | 1.858 | 3,906,550.00 | 2,103,050.00 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | OriginalCharSlice |
net6.0 | 2.06ms | 9.96μs | 39.9μs | 0 | 0 | 0 | 640 KB |
| master | OriginalCharSlice |
netcoreapp3.1 | 3.91ms | 1.21μs | 4.53μs | 0 | 0 | 0 | 640.05 KB |
| master | OriginalCharSlice |
net472 | 2.78ms | 961ns | 3.72μs | 0 | 0 | 0 | 638.98 KB |
| master | OptimizedCharSlice |
net6.0 | 1.47ms | 252ns | 907ns | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSlice |
netcoreapp3.1 | 2.79ms | 619ns | 2.23μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSlice |
net472 | 2.01ms | 654ns | 2.45μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net6.0 | 1.04ms | 1.82μs | 7.06μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
netcoreapp3.1 | 1.89ms | 965ns | 3.74μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net472 | 1.14ms | 400ns | 1.55μs | 0 | 0 | 0 | 0 b |
| #7938 | OriginalCharSlice |
net6.0 | 2.03ms | 1.08μs | 4.05μs | 0 | 0 | 0 | 640 KB |
| #7938 | OriginalCharSlice |
netcoreapp3.1 | 2.12ms | 8.89μs | 60.3μs | 0 | 0 | 0 | 640 KB |
| #7938 | OriginalCharSlice |
net472 | 2.58ms | 667ns | 2.41μs | 0 | 0 | 0 | 638.98 KB |
| #7938 | OptimizedCharSlice |
net6.0 | 1.45ms | 966ns | 3.61μs | 0 | 0 | 0 | 0 b |
| #7938 | OptimizedCharSlice |
netcoreapp3.1 | 2.75ms | 691ns | 2.68μs | 0 | 0 | 0 | 0 b |
| #7938 | OptimizedCharSlice |
net472 | 1.98ms | 753ns | 2.92μs | 0 | 0 | 0 | 0 b |
| #7938 | OptimizedCharSliceWithPool |
net6.0 | 1.01ms | 927ns | 3.59μs | 0 | 0 | 0 | 0 b |
| #7938 | OptimizedCharSliceWithPool |
netcoreapp3.1 | 823μs | 396ns | 2.68μs | 0 | 0 | 0 | 0 b |
| #7938 | OptimizedCharSliceWithPool |
net472 | 1.21ms | 473ns | 1.77μs | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #7938
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1
42.21 KB
42.61 KB
397 B
0.94%
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0
41.62 KB
41.86 KB
243 B
0.58%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 | 42.21 KB | 42.61 KB | 397 B | 0.94% |
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 | 41.62 KB | 41.86 KB | 243 B | 0.58% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 706μs | 336ns | 1.26μs | 0 | 0 | 0 | 41.62 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 648μs | 3.43μs | 17.1μs | 0 | 0 | 0 | 42.21 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 860μs | 3.89μs | 14μs | 4.46 | 0 | 0 | 55.89 KB |
| #7938 | WriteAndFlushEnrichedTraces |
net6.0 | 649μs | 1.52μs | 5.7μs | 0 | 0 | 0 | 41.86 KB |
| #7938 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 722μs | 3μs | 11.6μs | 0 | 0 | 0 | 42.61 KB |
| #7938 | WriteAndFlushEnrichedTraces |
net472 | 939μs | 4.81μs | 21.5μs | 8.33 | 4.17 | 0 | 56.01 KB |
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteNonQuery |
net6.0 | 1.87μs | 0.936ns | 3.62ns | 0 | 0 | 0 | 968 B |
| master | ExecuteNonQuery |
netcoreapp3.1 | 2.63μs | 11.9ns | 46.3ns | 0 | 0 | 0 | 960 B |
| master | ExecuteNonQuery |
net472 | 2.7μs | 2.1ns | 7.87ns | 0.148 | 0 | 0 | 931 B |
| #7938 | ExecuteNonQuery |
net6.0 | 1.94μs | 4.21ns | 15.8ns | 0 | 0 | 0 | 968 B |
| #7938 | ExecuteNonQuery |
netcoreapp3.1 | 2.55μs | 0.961ns | 3.72ns | 0 | 0 | 0 | 960 B |
| #7938 | ExecuteNonQuery |
net472 | 2.71μs | 1.92ns | 7.43ns | 0.135 | 0 | 0 | 931 B |
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | CallElasticsearch |
net6.0 | 1.72μs | 6.92ns | 26.8ns | 0 | 0 | 0 | 952 B |
| master | CallElasticsearch |
netcoreapp3.1 | 2.16μs | 11.2ns | 52.3ns | 0 | 0 | 0 | 968 B |
| master | CallElasticsearch |
net472 | 3.39μs | 4.54ns | 17.6ns | 0.137 | 0 | 0 | 955 B |
| master | CallElasticsearchAsync |
net6.0 | 1.73μs | 0.981ns | 3.67ns | 0 | 0 | 0 | 928 B |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 2.28μs | 9.88ns | 38.3ns | 0 | 0 | 0 | 1.02 KB |
| master | CallElasticsearchAsync |
net472 | 3.48μs | 3.62ns | 14ns | 0.156 | 0 | 0 | 1.01 KB |
| #7938 | CallElasticsearch |
net6.0 | 1.73μs | 7.42ns | 28.7ns | 0 | 0 | 0 | 952 B |
| #7938 | CallElasticsearch |
netcoreapp3.1 | 2.19μs | 10.3ns | 40ns | 0 | 0 | 0 | 968 B |
| #7938 | CallElasticsearch |
net472 | 3.4μs | 2.65ns | 10.3ns | 0.151 | 0 | 0 | 955 B |
| #7938 | CallElasticsearchAsync |
net6.0 | 1.72μs | 0.67ns | 2.59ns | 0 | 0 | 0 | 928 B |
| #7938 | CallElasticsearchAsync |
netcoreapp3.1 | 2.31μs | 11ns | 42.6ns | 0 | 0 | 0 | 1.02 KB |
| #7938 | CallElasticsearchAsync |
net472 | 3.65μs | 1.44ns | 5.39ns | 0.145 | 0 | 0 | 1.01 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteAsync |
net6.0 | 1.76μs | 7.45ns | 28.8ns | 0 | 0 | 0 | 896 B |
| master | ExecuteAsync |
netcoreapp3.1 | 2.31μs | 7.47ns | 28.9ns | 0 | 0 | 0 | 896 B |
| master | ExecuteAsync |
net472 | 2.54μs | 2.95ns | 11.4ns | 0.126 | 0 | 0 | 858 B |
| #7938 | ExecuteAsync |
net6.0 | 1.79μs | 8.94ns | 39ns | 0 | 0 | 0 | 896 B |
| #7938 | ExecuteAsync |
netcoreapp3.1 | 2.4μs | 9.64ns | 37.3ns | 0 | 0 | 0 | 896 B |
| #7938 | ExecuteAsync |
net472 | 2.56μs | 1.73ns | 6.49ns | 0.127 | 0 | 0 | 858 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendAsync |
net6.0 | 6.82μs | 14.8ns | 57.3ns | 0 | 0 | 0 | 2.29 KB |
| master | SendAsync |
netcoreapp3.1 | 8.4μs | 34.4ns | 133ns | 0 | 0 | 0 | 2.83 KB |
| master | SendAsync |
net472 | 11.8μs | 10.8ns | 41.9ns | 0.474 | 0 | 0 | 3.08 KB |
| #7938 | SendAsync |
net6.0 | 6.71μs | 8.28ns | 32.1ns | 0 | 0 | 0 | 2.29 KB |
| #7938 | SendAsync |
netcoreapp3.1 | 8.76μs | 30.6ns | 118ns | 0 | 0 | 0 | 2.83 KB |
| #7938 | SendAsync |
net472 | 11.8μs | 6.42ns | 24.9ns | 0.473 | 0 | 0 | 3.08 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #7938
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0
256.94 KB
277.91 KB
20.97 KB
8.16%
Fewer allocations 🎉 in #7938
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1
274.72 KB
272.57 KB
-2.15 KB
-0.78%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 256.94 KB | 277.91 KB | 20.97 KB | 8.16% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 274.72 KB | 272.57 KB | -2.15 KB | -0.78% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StringConcatBenchmark |
net6.0 | 45.1μs | 245ns | 1.27μs | 0 | 0 | 0 | 42.51 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 49μs | 260ns | 1.3μs | 0 | 0 | 0 | 42.54 KB |
| master | StringConcatBenchmark |
net472 | 57.2μs | 247ns | 986ns | 0 | 0 | 0 | 49.15 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 446μs | 2.06μs | 7.98μs | 0 | 0 | 0 | 256.94 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 530μs | 991ns | 4.95μs | 0 | 0 | 0 | 274.72 KB |
| master | StringConcatAspectBenchmark |
net472 | 399μs | 2.3μs | 19.4μs | 0 | 0 | 0 | 271.01 KB |
| #7938 | StringConcatBenchmark |
net6.0 | 50.1μs | 280ns | 1.75μs | 0 | 0 | 0 | 42.51 KB |
| #7938 | StringConcatBenchmark |
netcoreapp3.1 | 48.7μs | 286ns | 2.61μs | 0 | 0 | 0 | 42.54 KB |
| #7938 | StringConcatBenchmark |
net472 | 56.7μs | 179ns | 644ns | 0 | 0 | 0 | 49.15 KB |
| #7938 | StringConcatAspectBenchmark |
net6.0 | 483μs | 2.29μs | 9.43μs | 0 | 0 | 0 | 277.91 KB |
| #7938 | StringConcatAspectBenchmark |
netcoreapp3.1 | 505μs | 2.36μs | 8.84μs | 0 | 0 | 0 | 272.57 KB |
| #7938 | StringConcatAspectBenchmark |
net472 | 396μs | 2μs | 17.2μs | 0 | 0 | 0 | 270.8 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 2.68μs | 12.8ns | 51.1ns | 0 | 0 | 0 | 1.69 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.61μs | 18.1ns | 85ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
net472 | 3.82μs | 4.62ns | 17.9ns | 0.246 | 0 | 0 | 1.6 KB |
| #7938 | EnrichedLog |
net6.0 | 2.68μs | 13.1ns | 52.4ns | 0 | 0 | 0 | 1.69 KB |
| #7938 | EnrichedLog |
netcoreapp3.1 | 3.49μs | 16.3ns | 63ns | 0 | 0 | 0 | 1.7 KB |
| #7938 | EnrichedLog |
net472 | 3.86μs | 4.39ns | 17ns | 0.252 | 0 | 0 | 1.6 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 122μs | 85.5ns | 320ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
netcoreapp3.1 | 127μs | 117ns | 423ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
net472 | 166μs | 192ns | 743ns | 0 | 0 | 0 | 4.51 KB |
| #7938 | EnrichedLog |
net6.0 | 126μs | 169ns | 655ns | 0 | 0 | 0 | 4.31 KB |
| #7938 | EnrichedLog |
netcoreapp3.1 | 129μs | 227ns | 820ns | 0 | 0 | 0 | 4.31 KB |
| #7938 | EnrichedLog |
net472 | 170μs | 291ns | 1.13μs | 0 | 0 | 0 | 4.51 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 5.08μs | 24.9ns | 108ns | 0 | 0 | 0 | 2.24 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.82μs | 27.1ns | 105ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
net472 | 7.58μs | 6.43ns | 24.9ns | 0.301 | 0 | 0 | 2.05 KB |
| #7938 | EnrichedLog |
net6.0 | 4.99μs | 7.09ns | 27.5ns | 0 | 0 | 0 | 2.24 KB |
| #7938 | EnrichedLog |
netcoreapp3.1 | 6.86μs | 27.4ns | 106ns | 0 | 0 | 0 | 2.26 KB |
| #7938 | EnrichedLog |
net472 | 7.52μs | 4.71ns | 18.3ns | 0.301 | 0 | 0 | 2.05 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendReceive |
net6.0 | 1.96μs | 2.53ns | 9.46ns | 0 | 0 | 0 | 1.12 KB |
| master | SendReceive |
netcoreapp3.1 | 2.51μs | 12.3ns | 53.6ns | 0 | 0 | 0 | 1.14 KB |
| master | SendReceive |
net472 | 2.9μs | 1.4ns | 5.42ns | 0.177 | 0 | 0 | 1.12 KB |
| #7938 | SendReceive |
net6.0 | 1.92μs | 1.01ns | 3.92ns | 0 | 0 | 0 | 1.12 KB |
| #7938 | SendReceive |
netcoreapp3.1 | 2.56μs | 9.63ns | 37.3ns | 0 | 0 | 0 | 1.14 KB |
| #7938 | SendReceive |
net472 | 2.93μs | 1.66ns | 6.21ns | 0.175 | 0 | 0 | 1.12 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 4.36μs | 19.6ns | 73.3ns | 0 | 0 | 0 | 1.58 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.85μs | 13.3ns | 51.5ns | 0 | 0 | 0 | 1.63 KB |
| master | EnrichedLog |
net472 | 6.7μs | 11.5ns | 44.5ns | 0.301 | 0 | 0 | 2.03 KB |
| #7938 | EnrichedLog |
net6.0 | 4.46μs | 2.24ns | 8.38ns | 0 | 0 | 0 | 1.58 KB |
| #7938 | EnrichedLog |
netcoreapp3.1 | 5.83μs | 14.7ns | 57ns | 0 | 0 | 0 | 1.63 KB |
| #7938 | EnrichedLog |
net472 | 6.68μs | 6.56ns | 25.4ns | 0.301 | 0 | 0 | 2.03 KB |
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net6.0 | 768ns | 0.295ns | 1.14ns | 0 | 0 | 0 | 520 B |
| master | StartFinishSpan |
netcoreapp3.1 | 953ns | 5.07ns | 26.3ns | 0 | 0 | 0 | 520 B |
| master | StartFinishSpan |
net472 | 889ns | 0.15ns | 0.539ns | 0.0823 | 0 | 0 | 522 B |
| master | StartFinishScope |
net6.0 | 897ns | 4.1ns | 16.4ns | 0 | 0 | 0 | 640 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.13μs | 5.44ns | 21.1ns | 0 | 0 | 0 | 640 B |
| master | StartFinishScope |
net472 | 1.1μs | 0.248ns | 0.961ns | 0.0935 | 0 | 0 | 602 B |
| master | StartFinishTwoScopes |
net6.0 | 1.84μs | 0.671ns | 2.6ns | 0 | 0 | 0 | 1.19 KB |
| master | StartFinishTwoScopes |
netcoreapp3.1 | 2.21μs | 11.1ns | 49.6ns | 0 | 0 | 0 | 1.19 KB |
| master | StartFinishTwoScopes |
net472 | 2.14μs | 0.392ns | 1.52ns | 0.161 | 0 | 0 | 1.08 KB |
| #7938 | StartFinishSpan |
net6.0 | 792ns | 0.63ns | 2.44ns | 0 | 0 | 0 | 520 B |
| #7938 | StartFinishSpan |
netcoreapp3.1 | 962ns | 0.529ns | 2.05ns | 0 | 0 | 0 | 520 B |
| #7938 | StartFinishSpan |
net472 | 901ns | 0.366ns | 1.37ns | 0.081 | 0 | 0 | 522 B |
| #7938 | StartFinishScope |
net6.0 | 900ns | 0.319ns | 1.19ns | 0 | 0 | 0 | 640 B |
| #7938 | StartFinishScope |
netcoreapp3.1 | 1.14μs | 5.6ns | 25ns | 0 | 0 | 0 | 640 B |
| #7938 | StartFinishScope |
net472 | 1.08μs | 0.553ns | 2.14ns | 0.0923 | 0 | 0 | 602 B |
| #7938 | StartFinishTwoScopes |
net6.0 | 1.77μs | 8.66ns | 35.7ns | 0 | 0 | 0 | 1.19 KB |
| #7938 | StartFinishTwoScopes |
netcoreapp3.1 | 2.15μs | 9.95ns | 38.5ns | 0 | 0 | 0 | 1.19 KB |
| #7938 | StartFinishTwoScopes |
net472 | 2.12μs | 0.31ns | 1.12ns | 0.17 | 0 | 0 | 1.08 KB |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunOnMethodBegin |
net6.0 | 1.05μs | 0.41ns | 1.53ns | 0 | 0 | 0 | 640 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.36μs | 6.81ns | 31.2ns | 0 | 0 | 0 | 640 B |
| master | RunOnMethodBegin |
net472 | 1.47μs | 0.812ns | 3.04ns | 0.0885 | 0 | 0 | 602 B |
| #7938 | RunOnMethodBegin |
net6.0 | 1.07μs | 1.57ns | 6.1ns | 0 | 0 | 0 | 640 B |
| #7938 | RunOnMethodBegin |
netcoreapp3.1 | 1.37μs | 6.57ns | 27.9ns | 0 | 0 | 0 | 640 B |
| #7938 | RunOnMethodBegin |
net472 | 1.4μs | 0.241ns | 0.932ns | 0.0911 | 0 | 0 | 602 B |
lucaspimentel
approved these changes
Dec 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Fixes places in tests that currently use
new Tracer()to useScopedTracerinsteadReason for change
When you call
new Tracer(), a bunch of background jobs are started, some on thread pool threads, some on dedicated threads. If you don't explicitly shut down the tracer, these jobs may keep living, and ultimately act as a drain on resources in CI, leading to flake. e.g. a check of a recent failing test in CI revealed a lot of threads running the serialization loop, which potentially points to this kind of issueImplementation details
We introduced
ScopedTracerandTracerHelper.Create()to make doing this easier, by having a simple async disposable. This PR updates everywhere that was previously doingnew Tracer()to use the helpers instead. There are basically 3 patterns for this:new Tracer()was called in a constructor, implementIAsyncLifetimeand dispose it in theDisposeAsync()call.new Tracer()is called inline, useawait using var tracer = TracerHelper.Create()await usingTest coverage
All covered by existing tests, so hopefully we're good 🤞
Other details
This seems to be a relatively recent issue in CI, but I'm not sure why, these usages have persisted for a long time...