Handle null HttpRequest in AspNetCore naming
PR by Bits to fix issue 5f298210-3db0-11f0-abc8-da7ad0900002
You can ask for changes by mentioning @Datadog in a comment.
Feedback (especially what can be better) welcome in #code-gen-feedback!
Summary of changes
Added null safety checks and defensive exception handling to AspNetCoreHttpRequestHandler.GetDefaultResourceName() to prevent NullReferenceException when the HttpRequest is null. The method now returns a safe default resource name ("UNKNOWN /") instead of crashing. Added a new unit test to verify the null case is handled correctly.
Reason for change
A NullReferenceException occurred in the instrumentation-telemetry-data service when the ASP.NET Core diagnostic observer attempted to compute a resource name for a null HttpRequest during request completion. This happened in edge cases such as framework error paths or host-specific failures where the request object was not available during the stop event.
More details
The exception occurred in the Hosting.HttpRequestIn.Stop event handler. When StopAspNetCorePipelineScope() calls GetDefaultResourceName(HttpRequest) to set a default span resource name, it did not account for scenarios where the HttpRequest could be null. The method previously dereferenced request.Method and request.Path* without null validation, causing an immediate crash before the span could be properly finalized.
In rare stop-phase error paths (aborted/failed requests or late shutdown scenarios), the HttpRequest parameter can legitimately be null, and the code must gracefully handle this case.
Implementation details
- Added a null check at the start of
GetDefaultResourceName()to return "UNKNOWN /" if the request is null - Wrapped path construction in a try-catch block to handle any exceptions that may occur when accessing
PathBaseorPathproperties - Added null coalescing to handle cases where
UriHelpers.GetCleanUriPath()returns null - These defensive measures ensure the method always returns a valid resource name without throwing exceptions
Test coverage
Added a new unit test GetDefaultResourceName_ReturnsUnknownSlash_WhenRequestIsNull() that verifies the handler correctly returns "UNKNOWN /" when passed a null HttpRequest.
Other details
This fix makes the request handler more resilient to edge cases and prevents telemetry collection from crashing during request completion, even in error scenarios.
Bits AI Dev Agent Status: ✅ Done [Fix CI Errors]
You can ask for changes by mentioning @Datadog in a comment.
Benchmarks
Benchmarks Report for benchmark platform :snail:
Benchmarks for #7699 compared to master:
- 2 benchmarks are faster, with geometric mean 1.515
- 1 benchmarks are slower, with geometric mean 1.204
- 3 benchmarks have fewer allocations
- 5 benchmarks have more allocations
The following thresholds were used for comparing the benchmark speeds:
- Mann–Whitney U test with statistical test for significance of 5%
- Only results indicating a difference greater than 10% and 0.3 ns are considered.
Allocation changes below 0.5% are ignored.
Benchmark details
Benchmarks.Trace.ActivityBenchmark - Same speed :heavy_check_mark: More allocations :warning:
More allocations :warning: in #7699
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472
5.99 KB
6.13 KB
142 B
2.37%
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartStopWithChild |
net6.0 | 10.7μs | 60.3ns | 396ns | 0 | 0 | 0 | 5.5 KB |
| master | StartStopWithChild |
netcoreapp3.1 | 14.1μs | 73.8ns | 346ns | 0 | 0 | 0 | 5.72 KB |
| master | StartStopWithChild |
net472 | 22.1μs | 115ns | 541ns | 0.91 | 0.303 | 0 | 5.99 KB |
| #7699 | StartStopWithChild |
net6.0 | 10.2μs | 41.1ns | 169ns | 0 | 0 | 0 | 5.51 KB |
| #7699 | StartStopWithChild |
netcoreapp3.1 | 13.9μs | 73.9ns | 377ns | 0 | 0 | 0 | 5.71 KB |
| #7699 | StartStopWithChild |
net472 | 22.2μs | 115ns | 688ns | 0.904 | 0.201 | 0 | 6.13 KB |
Benchmarks.Trace.AgentWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 934μs | 83.7ns | 302ns | 0 | 0 | 0 | 2.71 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.08ms | 2.22μs | 8.29μs | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 1.2ms | 685ns | 2.47μs | 0 | 0 | 0 | 3.31 KB |
| #7699 | WriteAndFlushEnrichedTraces |
net6.0 | 931μs | 44ns | 159ns | 0 | 0 | 0 | 2.7 KB |
| #7699 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.04ms | 233ns | 901ns | 0 | 0 | 0 | 2.7 KB |
| #7699 | WriteAndFlushEnrichedTraces |
net472 | 1.19ms | 188ns | 650ns | 0 | 0 | 0 | 3.31 KB |
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Unknown :shrug: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | AllCycleSimpleBody |
net6.0 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| master | AllCycleSimpleBody |
netcoreapp3.1 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| master | AllCycleSimpleBody |
net472 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| master | AllCycleMoreComplexBody |
net6.0 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| master | AllCycleMoreComplexBody |
netcoreapp3.1 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| master | AllCycleMoreComplexBody |
net472 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| master | ObjectExtractorSimpleBody |
net6.0 | 327ns | 0.162ns | 0.605ns | 0 | 0 | 0 | 280 B |
| master | ObjectExtractorSimpleBody |
netcoreapp3.1 | 399ns | 2.17ns | 11.5ns | 0 | 0 | 0 | 272 B |
| master | ObjectExtractorSimpleBody |
net472 | 299ns | 0.0276ns | 0.0994ns | 0.0436 | 0 | 0 | 281 B |
| master | ObjectExtractorMoreComplexBody |
net6.0 | 6.32μs | 34.1ns | 156ns | 0 | 0 | 0 | 3.78 KB |
| master | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.91μs | 29ns | 112ns | 0 | 0 | 0 | 3.69 KB |
| master | ObjectExtractorMoreComplexBody |
net472 | 6.74μs | 1.07ns | 4.14ns | 0.573 | 0 | 0 | 3.8 KB |
| #7699 | AllCycleSimpleBody |
net6.0 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7699 | AllCycleSimpleBody |
netcoreapp3.1 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7699 | AllCycleSimpleBody |
net472 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7699 | AllCycleMoreComplexBody |
net6.0 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7699 | AllCycleMoreComplexBody |
netcoreapp3.1 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7699 | AllCycleMoreComplexBody |
net472 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7699 | ObjectExtractorSimpleBody |
net6.0 | 321ns | 0.24ns | 0.898ns | 0 | 0 | 0 | 280 B |
| #7699 | ObjectExtractorSimpleBody |
netcoreapp3.1 | 400ns | 2.19ns | 12.6ns | 0 | 0 | 0 | 272 B |
| #7699 | ObjectExtractorSimpleBody |
net472 | 301ns | 0.0458ns | 0.171ns | 0.0439 | 0 | 0 | 281 B |
| #7699 | ObjectExtractorMoreComplexBody |
net6.0 | 6.37μs | 24ns | 92.8ns | 0 | 0 | 0 | 3.78 KB |
| #7699 | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.71μs | 38ns | 161ns | 0 | 0 | 0 | 3.69 KB |
| #7699 | ObjectExtractorMoreComplexBody |
net472 | 6.74μs | 5.52ns | 21.4ns | 0.6 | 0 | 0 | 3.8 KB |
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EncodeArgs |
net6.0 | 76.2μs | 274ns | 1.06μs | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
netcoreapp3.1 | 97.6μs | 185ns | 717ns | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
net472 | 109μs | 5.51ns | 20.6ns | 4.89 | 0 | 0 | 32.51 KB |
| master | EncodeLegacyArgs |
net6.0 | 145μs | 202ns | 783ns | 0 | 0 | 0 | 2.15 KB |
| master | EncodeLegacyArgs |
netcoreapp3.1 | 200μs | 201ns | 754ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
net472 | 262μs | 77.9ns | 302ns | 0 | 0 | 0 | 2.16 KB |
| #7699 | EncodeArgs |
net6.0 | 77.6μs | 28.3ns | 106ns | 0 | 0 | 0 | 32.4 KB |
| #7699 | EncodeArgs |
netcoreapp3.1 | 97.2μs | 246ns | 954ns | 0 | 0 | 0 | 32.4 KB |
| #7699 | EncodeArgs |
net472 | 109μs | 39.2ns | 152ns | 4.92 | 0 | 0 | 32.51 KB |
| #7699 | EncodeLegacyArgs |
net6.0 | 144μs | 19.1ns | 71.4ns | 0 | 0 | 0 | 2.15 KB |
| #7699 | EncodeLegacyArgs |
netcoreapp3.1 | 199μs | 173ns | 672ns | 0 | 0 | 0 | 2.14 KB |
| #7699 | EncodeLegacyArgs |
net472 | 267μs | 78.4ns | 304ns | 0 | 0 | 0 | 2.16 KB |
Benchmarks.Trace.Asm.AppSecWafBenchmark - Faster :tada: Same allocations :heavy_check_mark:
Faster :tada: in #7699
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1
2.063
855,495.83
414,713.36
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunWafRealisticBenchmark |
net6.0 | 395μs | 55.5ns | 215ns | 0 | 0 | 0 | 4.55 KB |
| master | RunWafRealisticBenchmark |
netcoreapp3.1 | 850μs | 4.1μs | 15.9μs | 0 | 0 | 0 | 4.48 KB |
| master | RunWafRealisticBenchmark |
net472 | 428μs | 54.6ns | 197ns | 0 | 0 | 0 | 4.66 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 284μs | 57.9ns | 201ns | 0 | 0 | 0 | 2.24 KB |
| master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 709μs | 3.74μs | 19.5μs | 0 | 0 | 0 | 2.22 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net472 | 312μs | 30.3ns | 117ns | 0 | 0 | 0 | 2.29 KB |
| #7699 | RunWafRealisticBenchmark |
net6.0 | 421μs | 121ns | 452ns | 0 | 0 | 0 | 4.55 KB |
| #7699 | RunWafRealisticBenchmark |
netcoreapp3.1 | 415μs | 75ns | 281ns | 0 | 0 | 0 | 4.48 KB |
| #7699 | RunWafRealisticBenchmark |
net472 | 454μs | 220ns | 853ns | 0 | 0 | 0 | 4.66 KB |
| #7699 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 313μs | 77.3ns | 300ns | 0 | 0 | 0 | 2.24 KB |
| #7699 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 676μs | 13.3μs | 133μs | 0 | 0 | 0 | 2.22 KB |
| #7699 | RunWafRealisticBenchmarkWithAttack |
net472 | 335μs | 114ns | 442ns | 0 | 0 | 0 | 2.29 KB |
Benchmarks.Trace.AspNetCoreBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendRequest |
net6.0 | 60.4μs | 48.4ns | 188ns | 0 | 0 | 0 | 14.52 KB |
| master | SendRequest |
netcoreapp3.1 | 70.6μs | 147ns | 531ns | 0 | 0 | 0 | 17.42 KB |
| master | SendRequest |
net472 | 0.000579ns | 0.000327ns | 0.00127ns | 0 | 0 | 0 | 0 b |
| #7699 | SendRequest |
net6.0 | 61.6μs | 53ns | 191ns | 0 | 0 | 0 | 14.52 KB |
| #7699 | SendRequest |
netcoreapp3.1 | 71.9μs | 149ns | 537ns | 0 | 0 | 0 | 17.42 KB |
| #7699 | SendRequest |
net472 | 0.00028ns | 0.00028ns | 0.00109ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CharSliceBenchmark - Slower :warning: More allocations :warning:
Slower :warning: in #7699
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472
1.204
1,900,608.93
2,288,981.25
Faster :tada: in #7699
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0
1.112
1,495,570.83
1,344,825.69
More allocations :warning: in #7699
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0
4 B
7 B
3 B
75.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0
3 B
4 B
1 B
33.33%
Fewer allocations :tada: in #7699
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1
11 B
0 b
-11 B
-100.00%
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | OriginalCharSlice |
net6.0 | 1.88ms | 5.76μs | 22.3μs | 0 | 0 | 0 | 640 KB |
| master | OriginalCharSlice |
netcoreapp3.1 | 2.1ms | 7.83μs | 28.2μs | 0 | 0 | 0 | 640 KB |
| master | OriginalCharSlice |
net472 | 2.61ms | 115ns | 413ns | 100 | 0 | 0 | 641.95 KB |
| master | OptimizedCharSlice |
net6.0 | 1.49ms | 440ns | 1.7μs | 0 | 0 | 0 | 4 B |
| master | OptimizedCharSlice |
netcoreapp3.1 | 1.65ms | 678ns | 2.63μs | 0 | 0 | 0 | 1 B |
| master | OptimizedCharSlice |
net472 | 1.9ms | 352ns | 1.36μs | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net6.0 | 843μs | 16ns | 59.7ns | 0 | 0 | 0 | 3 B |
| master | OptimizedCharSliceWithPool |
netcoreapp3.1 | 841μs | 123ns | 475ns | 0 | 0 | 0 | 11 B |
| master | OptimizedCharSliceWithPool |
net472 | 1.23ms | 118ns | 441ns | 0 | 0 | 0 | 0 b |
| #7699 | OriginalCharSlice |
net6.0 | 1.89ms | 2.94μs | 11.4μs | 0 | 0 | 0 | 640 KB |
| #7699 | OriginalCharSlice |
netcoreapp3.1 | 2.15ms | 2.6μs | 9.73μs | 0 | 0 | 0 | 640 KB |
| #7699 | OriginalCharSlice |
net472 | 2.87ms | 743ns | 2.88μs | 100 | 0 | 0 | 641.95 KB |
| #7699 | OptimizedCharSlice |
net6.0 | 1.34ms | 261ns | 1.01μs | 0 | 0 | 0 | 7 B |
| #7699 | OptimizedCharSlice |
netcoreapp3.1 | 1.68ms | 454ns | 1.76μs | 0 | 0 | 0 | 1 B |
| #7699 | OptimizedCharSlice |
net472 | 2.29ms | 2.75μs | 10.3μs | 0 | 0 | 0 | 0 b |
| #7699 | OptimizedCharSliceWithPool |
net6.0 | 802μs | 73.5ns | 285ns | 0 | 0 | 0 | 4 B |
| #7699 | OptimizedCharSliceWithPool |
netcoreapp3.1 | 811μs | 210ns | 813ns | 0 | 0 | 0 | 0 b |
| #7699 | OptimizedCharSliceWithPool |
net472 | 1.15ms | 151ns | 584ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 727μs | 4.1μs | 27.5μs | 0 | 0 | 0 | 41.6 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 738μs | 1.55μs | 5.81μs | 0 | 0 | 0 | 41.86 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 852μs | 2.7μs | 10.5μs | 8.33 | 0 | 0 | 56.12 KB |
| #7699 | WriteAndFlushEnrichedTraces |
net6.0 | 695μs | 3.95μs | 28.2μs | 0 | 0 | 0 | 41.73 KB |
| #7699 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 667μs | 2.05μs | 7.69μs | 0 | 0 | 0 | 42.06 KB |
| #7699 | WriteAndFlushEnrichedTraces |
net472 | 856μs | 3.1μs | 12μs | 8.33 | 0 | 0 | 55.98 KB |
Benchmarks.Trace.DbCommandBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteNonQuery |
net6.0 | 1.91μs | 9.33ns | 39.6ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
netcoreapp3.1 | 2.59μs | 8.32ns | 32.2ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
net472 | 2.85μs | 5.62ns | 21.8ns | 0.156 | 0.0142 | 0 | 987 B |
| #7699 | ExecuteNonQuery |
net6.0 | 1.96μs | 9.71ns | 40ns | 0 | 0 | 0 | 1.02 KB |
| #7699 | ExecuteNonQuery |
netcoreapp3.1 | 2.67μs | 11.1ns | 42.9ns | 0 | 0 | 0 | 1.02 KB |
| #7699 | ExecuteNonQuery |
net472 | 2.85μs | 3.32ns | 12.8ns | 0.143 | 0.0143 | 0 | 987 B |
Benchmarks.Trace.ElasticsearchBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | CallElasticsearch |
net6.0 | 1.69μs | 8.73ns | 42.8ns | 0 | 0 | 0 | 1.03 KB |
| master | CallElasticsearch |
netcoreapp3.1 | 2.29μs | 1.65ns | 6.41ns | 0 | 0 | 0 | 1.03 KB |
| master | CallElasticsearch |
net472 | 3.51μs | 1.45ns | 5.44ns | 0.158 | 0 | 0 | 1.04 KB |
| master | CallElasticsearchAsync |
net6.0 | 1.82μs | 1.13ns | 4.22ns | 0 | 0 | 0 | 1.01 KB |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 2.4μs | 5.89ns | 22.8ns | 0 | 0 | 0 | 1.08 KB |
| master | CallElasticsearchAsync |
net472 | 3.65μs | 3.17ns | 12.3ns | 0.164 | 0 | 0 | 1.1 KB |
| #7699 | CallElasticsearch |
net6.0 | 1.79μs | 9.39ns | 48.8ns | 0 | 0 | 0 | 1.03 KB |
| #7699 | CallElasticsearch |
netcoreapp3.1 | 2.15μs | 11ns | 52.9ns | 0 | 0 | 0 | 1.03 KB |
| #7699 | CallElasticsearch |
net472 | 3.61μs | 5.98ns | 23.2ns | 0.163 | 0 | 0 | 1.04 KB |
| #7699 | CallElasticsearchAsync |
net6.0 | 1.92μs | 9.29ns | 38.3ns | 0 | 0 | 0 | 1.01 KB |
| #7699 | CallElasticsearchAsync |
netcoreapp3.1 | 2.3μs | 8.35ns | 32.3ns | 0 | 0 | 0 | 1.08 KB |
| #7699 | CallElasticsearchAsync |
net472 | 3.71μs | 3.28ns | 12.3ns | 0.168 | 0 | 0 | 1.1 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteAsync |
net6.0 | 1.85μs | 1.23ns | 4.61ns | 0 | 0 | 0 | 952 B |
| master | ExecuteAsync |
netcoreapp3.1 | 2.49μs | 7.76ns | 30.1ns | 0 | 0 | 0 | 952 B |
| master | ExecuteAsync |
net472 | 2.68μs | 4.95ns | 17.8ns | 0.133 | 0 | 0 | 915 B |
| #7699 | ExecuteAsync |
net6.0 | 1.96μs | 6.76ns | 26.2ns | 0 | 0 | 0 | 952 B |
| #7699 | ExecuteAsync |
netcoreapp3.1 | 2.44μs | 1.57ns | 6.08ns | 0 | 0 | 0 | 952 B |
| #7699 | ExecuteAsync |
net472 | 2.62μs | 2.73ns | 10.6ns | 0.145 | 0 | 0 | 915 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendAsync |
net6.0 | 6.72μs | 7.22ns | 27ns | 0 | 0 | 0 | 2.36 KB |
| master | SendAsync |
netcoreapp3.1 | 8.59μs | 30ns | 116ns | 0 | 0 | 0 | 2.9 KB |
| master | SendAsync |
net472 | 12.2μs | 8.24ns | 31.9ns | 0.487 | 0 | 0 | 3.18 KB |
| #7699 | SendAsync |
net6.0 | 6.66μs | 3.64ns | 12.6ns | 0 | 0 | 0 | 2.36 KB |
| #7699 | SendAsync |
netcoreapp3.1 | 8.48μs | 23.3ns | 90.2ns | 0 | 0 | 0 | 2.9 KB |
| #7699 | SendAsync |
net472 | 12.4μs | 10.2ns | 36.9ns | 0.498 | 0 | 0 | 3.18 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed :heavy_check_mark: More allocations :warning:
More allocations :warning: in #7699
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0
259.43 KB
275.9 KB
16.46 KB
6.35%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472
278.53 KB
286.72 KB
8.19 KB
2.94%
Fewer allocations :tada: in #7699
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1
257.92 KB
255.95 KB
-1.97 KB
-0.76%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0
44.05 KB
43.44 KB
-608 B
-1.38%
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StringConcatBenchmark |
net6.0 | 44.8μs | 218ns | 1.31μs | 0 | 0 | 0 | 44.05 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 52μs | 565ns | 5.54μs | 0 | 0 | 0 | 43.1 KB |
| master | StringConcatBenchmark |
net472 | 56.4μs | 277ns | 1.14μs | 0 | 0 | 0 | 65.54 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 470μs | 2.29μs | 9.71μs | 0 | 0 | 0 | 259.43 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 495μs | 2.17μs | 8.13μs | 0 | 0 | 0 | 257.92 KB |
| master | StringConcatAspectBenchmark |
net472 | 402μs | 2.08μs | 10.6μs | 0 | 0 | 0 | 278.53 KB |
| #7699 | StringConcatBenchmark |
net6.0 | 41.2μs | 220ns | 1.18μs | 0 | 0 | 0 | 43.44 KB |
| #7699 | StringConcatBenchmark |
netcoreapp3.1 | 48.5μs | 268ns | 1.97μs | 0 | 0 | 0 | 42.9 KB |
| #7699 | StringConcatBenchmark |
net472 | 57.8μs | 245ns | 949ns | 0 | 0 | 0 | 65.54 KB |
| #7699 | StringConcatAspectBenchmark |
net6.0 | 466μs | 1.57μs | 5.65μs | 0 | 0 | 0 | 275.9 KB |
| #7699 | StringConcatAspectBenchmark |
netcoreapp3.1 | 499μs | 1.99μs | 7.46μs | 0 | 0 | 0 | 255.95 KB |
| #7699 | StringConcatAspectBenchmark |
net472 | 410μs | 2.08μs | 9.77μs | 0 | 0 | 0 | 286.72 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 2.65μs | 2.33ns | 9.03ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.63μs | 3.52ns | 13.2ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
net472 | 3.91μs | 3.22ns | 12.5ns | 0.254 | 0 | 0 | 1.64 KB |
| #7699 | EnrichedLog |
net6.0 | 2.62μs | 12.9ns | 59.3ns | 0 | 0 | 0 | 1.7 KB |
| #7699 | EnrichedLog |
netcoreapp3.1 | 3.62μs | 7.53ns | 29.2ns | 0 | 0 | 0 | 1.7 KB |
| #7699 | EnrichedLog |
net472 | 3.83μs | 2.74ns | 10.6ns | 0.25 | 0 | 0 | 1.64 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 122μs | 58.1ns | 201ns | 0 | 0 | 0 | 4.32 KB |
| master | EnrichedLog |
netcoreapp3.1 | 128μs | 85ns | 318ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
net472 | 166μs | 66.7ns | 258ns | 0 | 0 | 0 | 4.51 KB |
| #7699 | EnrichedLog |
net6.0 | 123μs | 76.3ns | 275ns | 0 | 0 | 0 | 4.31 KB |
| #7699 | EnrichedLog |
netcoreapp3.1 | 127μs | 229ns | 824ns | 0 | 0 | 0 | 4.31 KB |
| #7699 | EnrichedLog |
net472 | 166μs | 52.5ns | 196ns | 0 | 0 | 0 | 4.52 KB |
Benchmarks.Trace.NLogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 5.12μs | 6.19ns | 24ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.87μs | 18.6ns | 69.4ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
net472 | 7.71μs | 6.06ns | 23.5ns | 0.31 | 0 | 0 | 2.08 KB |
| #7699 | EnrichedLog |
net6.0 | 5.16μs | 20.3ns | 78.5ns | 0 | 0 | 0 | 2.26 KB |
| #7699 | EnrichedLog |
netcoreapp3.1 | 6.98μs | 13.3ns | 51.7ns | 0 | 0 | 0 | 2.26 KB |
| #7699 | EnrichedLog |
net472 | 7.75μs | 5.85ns | 22.6ns | 0.31 | 0 | 0 | 2.08 KB |
Benchmarks.Trace.RedisBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendReceive |
net6.0 | 1.99μs | 9.46ns | 36.7ns | 0 | 0 | 0 | 1.2 KB |
| master | SendReceive |
netcoreapp3.1 | 2.7μs | 12.3ns | 47.6ns | 0 | 0 | 0 | 1.2 KB |
| master | SendReceive |
net472 | 2.99μs | 1.5ns | 5.81ns | 0.178 | 0 | 0 | 1.2 KB |
| #7699 | SendReceive |
net6.0 | 1.99μs | 10.5ns | 54.4ns | 0 | 0 | 0 | 1.2 KB |
| #7699 | SendReceive |
netcoreapp3.1 | 2.64μs | 12.1ns | 48.4ns | 0 | 0 | 0 | 1.2 KB |
| #7699 | SendReceive |
net472 | 3.21μs | 4ns | 15.5ns | 0.191 | 0 | 0 | 1.2 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 4.23μs | 6.2ns | 23.2ns | 0 | 0 | 0 | 1.58 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.5μs | 11.1ns | 41.4ns | 0 | 0 | 0 | 1.63 KB |
| master | EnrichedLog |
net472 | 6.67μs | 4.39ns | 16.4ns | 0.299 | 0 | 0 | 2.03 KB |
| #7699 | EnrichedLog |
net6.0 | 4.3μs | 7.22ns | 28ns | 0 | 0 | 0 | 1.58 KB |
| #7699 | EnrichedLog |
netcoreapp3.1 | 5.67μs | 13.9ns | 53.9ns | 0 | 0 | 0 | 1.63 KB |
| #7699 | EnrichedLog |
net472 | 6.71μs | 6.8ns | 26.3ns | 0.303 | 0 | 0 | 2.03 KB |
Benchmarks.Trace.SpanBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net6.0 | 771ns | 0.257ns | 0.962ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
netcoreapp3.1 | 958ns | 4.95ns | 22.7ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
net472 | 940ns | 0.637ns | 2.47ns | 0.0907 | 0 | 0 | 578 B |
| master | StartFinishScope |
net6.0 | 902ns | 4.2ns | 17.3ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.16μs | 6.23ns | 31.8ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
net472 | 1.17μs | 0.28ns | 1.05ns | 0.0999 | 0 | 0 | 658 B |
| #7699 | StartFinishSpan |
net6.0 | 787ns | 3.88ns | 16.9ns | 0 | 0 | 0 | 576 B |
| #7699 | StartFinishSpan |
netcoreapp3.1 | 956ns | 4.46ns | 17.3ns | 0 | 0 | 0 | 576 B |
| #7699 | StartFinishSpan |
net472 | 917ns | 0.165ns | 0.617ns | 0.0917 | 0 | 0 | 578 B |
| #7699 | StartFinishScope |
net6.0 | 933ns | 4.38ns | 16.4ns | 0 | 0 | 0 | 696 B |
| #7699 | StartFinishScope |
netcoreapp3.1 | 1.19μs | 5.94ns | 25.9ns | 0 | 0 | 0 | 696 B |
| #7699 | StartFinishScope |
net472 | 1.15μs | 0.436ns | 1.69ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunOnMethodBegin |
net6.0 | 1.04μs | 5.55ns | 29.9ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.45μs | 5.22ns | 19.5ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.46μs | 1.28ns | 4.95ns | 0.103 | 0 | 0 | 658 B |
| #7699 | RunOnMethodBegin |
net6.0 | 1.1μs | 0.355ns | 1.38ns | 0 | 0 | 0 | 696 B |
| #7699 | RunOnMethodBegin |
netcoreapp3.1 | 1.4μs | 6.62ns | 27.3ns | 0 | 0 | 0 | 696 B |
| #7699 | RunOnMethodBegin |
net472 | 1.45μs | 0.601ns | 2.33ns | 0.101 | 0 | 0 | 658 B |
Execution-Time Benchmarks Report :stopwatch:
Execution-time results for samples comparing the following branches/commits:
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 shown 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).
gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat X
axisFormat %s
todayMarker off
section Bailout
This PR (7699) - mean (74ms) : 73, 76
. : milestone, 74,
master - mean (74ms) : 73, 76
. : milestone, 74,
section Baseline
This PR (7699) - mean (70ms) : 68, 72
. : milestone, 70,
master - mean (70ms) : 68, 72
. : milestone, 70,
section CallTarget+Inlining+NGEN
This PR (7699) - mean (1,066ms) : 995, 1137
. : milestone, 1066,
master - mean (1,079ms) : 979, 1179
. : milestone, 1079,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Bailout
This PR (7699) - mean (110ms) : 108, 112
. : milestone, 110,
master - mean (110ms) : 108, 112
. : milestone, 110,
section Baseline
This PR (7699) - mean (109ms) : 107, 112
. : milestone, 109,
master - mean (109ms) : 104, 115
. : milestone, 109,
section CallTarget+Inlining+NGEN
This PR (7699) - mean (758ms) : 725, 790
. : milestone, 758,
master - mean (753ms) : 731, 775
. : milestone, 753,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Bailout
This PR (7699) - mean (99ms) : 96, 101
. : milestone, 99,
master - mean (98ms) : 96, 100
. : milestone, 98,
section Baseline
This PR (7699) - mean (97ms) : 94, 101
. : milestone, 97,
master - mean (97ms) : 94, 100
. : milestone, 97,
section CallTarget+Inlining+NGEN
This PR (7699) - mean (728ms) : 669, 787
. : milestone, 728,
master - mean (727ms) : 675, 778
. : milestone, 727,
gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat X
axisFormat %s
todayMarker off
section Bailout
This PR (7699) - mean (98ms) : 96, 99
. : milestone, 98,
master - mean (97ms) : 95, 99
. : milestone, 97,
section Baseline
This PR (7699) - mean (96ms) : 93, 99
. : milestone, 96,
master - mean (96ms) : 93, 98
. : milestone, 96,
section CallTarget+Inlining+NGEN
This PR (7699) - mean (673ms) : 659, 687
. : milestone, 673,
master - mean (672ms) : 655, 690
. : milestone, 672,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat X
axisFormat %s
todayMarker off
section Bailout
This PR (7699) - mean (197ms) : 195, 200
. : milestone, 197,
master - mean (197ms) : 194, 200
. : milestone, 197,
section Baseline
This PR (7699) - mean (194ms) : 191, 197
. : milestone, 194,
master - mean (193ms) : 189, 198
. : milestone, 193,
section CallTarget+Inlining+NGEN
This PR (7699) - mean (1,167ms) : 1109, 1225
. : milestone, 1167,
master - mean (1,181ms) : 1090, 1272
. : milestone, 1181,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Bailout
This PR (7699) - mean (279ms) : 275, 284
. : milestone, 279,
master - mean (280ms) : 274, 286
. : milestone, 280,
section Baseline
This PR (7699) - mean (279ms) : 273, 285
. : milestone, 279,
master - mean (280ms) : 271, 288
. : milestone, 280,
section CallTarget+Inlining+NGEN
This PR (7699) - mean (947ms) : 907, 987
. : milestone, 947,
master - mean (983ms) : 879, 1086
. : milestone, 983,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Bailout
This PR (7699) - mean (271ms) : 267, 275
. : milestone, 271,
master - mean (271ms) : 267, 275
. : milestone, 271,
section Baseline
This PR (7699) - mean (271ms) : 265, 278
. : milestone, 271,
master - mean (292ms) : 228, 356
. : milestone, 292,
section CallTarget+Inlining+NGEN
This PR (7699) - mean (951ms) : 892, 1010
. : milestone, 951,
master - mean (937ms) : 878, 996
. : milestone, 937,
gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat X
axisFormat %s
todayMarker off
section Bailout
This PR (7699) - mean (271ms) : 267, 275
. : milestone, 271,
master - mean (270ms) : 267, 274
. : milestone, 270,
section Baseline
This PR (7699) - mean (271ms) : 266, 275
. : milestone, 271,
master - mean (271ms) : 266, 276
. : milestone, 271,
section CallTarget+Inlining+NGEN
This PR (7699) - mean (859ms) : 838, 880
. : milestone, 859,
master - mean (863ms) : 837, 888
. : milestone, 863,
@codex review
Codex Review: Didn't find any major issues. More of your lovely PRs please.
ℹ️ 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".