dd-trace-dotnet icon indicating copy to clipboard operation
dd-trace-dotnet copied to clipboard

Check if `httpContext.Response` is not `null`

Open bouwkast opened this issue 2 months ago • 2 comments

Summary of changes

Saw a couple of of NullReferenceException from calling things in HttpContext.Response. so checking if Response is not null

Reason for change

Error : Event Exception: {EventName}
System.NullReferenceException
   at Microsoft.AspNetCore.Http.DefaultHttpResponse.get_StatusCode()
   at Datadog.Trace.PlatformHelpers.AspNetCoreHttpRequestHandler.StopAspNetCorePipelineScope(Tracer tracer, Security security, Scope rootScope, HttpContext httpContext)
   at Datadog.Trace.DiagnosticListeners.AspNetCoreDiagnosticObserver.OnHostingHttpRequestInStop(Object arg)
   at Datadog.Trace.DiagnosticListeners.AspNetCoreDiagnosticObserver.OnNext(String eventName, Object arg)
   at Datadog.Trace.DiagnosticListeners.DiagnosticObserver.System.IObserver<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.OnNext(KeyValuePair`2 value)
Error : Event Exception: {EventName}
System.NullReferenceException
   at Datadog.Trace.PlatformHelpers.AspNetCoreHttpRequestHandler.StopAspNetCorePipelineScope(Tracer tracer, Security security, Scope rootScope, HttpContext httpContext)
   at Datadog.Trace.DiagnosticListeners.AspNetCoreDiagnosticObserver.OnHostingHttpRequestInStop(Object arg)
   at Datadog.Trace.DiagnosticListeners.DiagnosticObserver.System.IObserver<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.OnNext(KeyValuePair`2 value)
Error : Event Exception: {EventName}
System.NullReferenceException
   at Datadog.Trace.DiagnosticListeners.AspNetCoreDiagnosticObserver.OnHostingHttpRequestInStop(Object arg)
   at Datadog.Trace.DiagnosticListeners.DiagnosticObserver.System.IObserver<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.OnNext(KeyValuePair`2 value)

Implementation details

Added some null checks / protections

Test coverage

Looked at https://github.com/DataDog/dd-trace-dotnet/blob/5f33ec08a4789ebf123c5ea1b5430ccadd38b7ce/tracer/test/Datadog.Trace.Tests/PlatformHelpers/AspNetCoreHttpRequestHandlerTests.cs#L15, but it doesn't look to be super straightforward to test.

Other details

bouwkast avatar Oct 28 '25 13:10 bouwkast

It makes me so sad we have to handle this. HttpContext.Response is non-null by definition 🙁

Yeah I'm not sure exactly how this comes about?

Should we opt to accept a level of exceptions here as it was quite low volume?

bouwkast avatar Oct 28 '25 13:10 bouwkast

Benchmarks

Benchmarks Report for benchmark platform :snail:

Benchmarks for #7720 compared to master:

  • 2 benchmarks are slower, with geometric mean 2.270
  • 5 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: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.5μs 59.8ns 406ns 0 0 0 5.49 KB
master StartStopWithChild netcoreapp3.1 13.5μs 69.7ns 334ns 0 0 0 5.72 KB
master StartStopWithChild net472 22.3μs 122ns 711ns 0.98 0.327 0.109 6.05 KB
#7720 StartStopWithChild net6.0 10.6μs 55.9ns 291ns 0 0 0 5.51 KB
#7720 StartStopWithChild netcoreapp3.1 14μs 69.7ns 287ns 0 0 0 5.73 KB
#7720 StartStopWithChild net472 21.1μs 101ns 390ns 0.978 0.326 0.109 6.04 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 935μs 96ns 346ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.03ms 220ns 853ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.19ms 582ns 2.25μs 0 0 0 3.31 KB
#7720 WriteAndFlushEnrichedTraces net6.0 949μs 200ns 775ns 0 0 0 2.71 KB
#7720 WriteAndFlushEnrichedTraces netcoreapp3.1 1.01ms 139ns 540ns 0 0 0 2.7 KB
#7720 WriteAndFlushEnrichedTraces net472 1.19ms 45.9ns 172ns 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 330ns 0.555ns 2.08ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 409ns 0.489ns 1.83ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 299ns 0.0231ns 0.0834ns 0.0438 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.27μs 24.5ns 95ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.94μs 8.1ns 31.4ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.61μs 5.12ns 19.8ns 0.595 0 0 3.8 KB
#7720 AllCycleSimpleBody net6.0 N/A N/A N/A NaN NaN NaN 0 b
#7720 AllCycleSimpleBody netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#7720 AllCycleSimpleBody net472 N/A N/A N/A NaN NaN NaN 0 b
#7720 AllCycleMoreComplexBody net6.0 N/A N/A N/A NaN NaN NaN 0 b
#7720 AllCycleMoreComplexBody netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#7720 AllCycleMoreComplexBody net472 N/A N/A N/A NaN NaN NaN 0 b
#7720 ObjectExtractorSimpleBody net6.0 320ns 1.72ns 9.59ns 0 0 0 280 B
#7720 ObjectExtractorSimpleBody netcoreapp3.1 386ns 2.21ns 16.1ns 0 0 0 272 B
#7720 ObjectExtractorSimpleBody net472 305ns 0.0258ns 0.0997ns 0.0446 0 0 281 B
#7720 ObjectExtractorMoreComplexBody net6.0 6.28μs 31ns 116ns 0 0 0 3.78 KB
#7720 ObjectExtractorMoreComplexBody netcoreapp3.1 7.91μs 39ns 165ns 0 0 0 3.69 KB
#7720 ObjectExtractorMoreComplexBody net472 6.64μs 1.56ns 5.84ns 0.598 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 75.4μs 271ns 1.05μs 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 97.7μs 27.7ns 107ns 0 0 0 32.4 KB
master EncodeArgs net472 109μs 53.7ns 208ns 4.91 0 0 32.51 KB
master EncodeLegacyArgs net6.0 144μs 6.8ns 26.3ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 202μs 570ns 2.21μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 263μs 33.9ns 122ns 0 0 0 2.17 KB
#7720 EncodeArgs net6.0 76.4μs 264ns 988ns 0 0 0 32.4 KB
#7720 EncodeArgs netcoreapp3.1 98.1μs 106ns 409ns 0 0 0 32.4 KB
#7720 EncodeArgs net472 109μs 14.2ns 49.3ns 4.92 0 0 32.5 KB
#7720 EncodeLegacyArgs net6.0 146μs 29.1ns 113ns 0 0 0 2.15 KB
#7720 EncodeLegacyArgs netcoreapp3.1 199μs 309ns 1.2μs 0 0 0 2.14 KB
#7720 EncodeLegacyArgs net472 265μs 58.6ns 227ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower :warning: Same allocations :heavy_check_mark:

Slower :warning: in #7720

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 2.456 298,308.56 732,580.18
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 2.098 410,525.21 861,199.17

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 396μs 64.5ns 250ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 410μs 67.3ns 252ns 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 431μs 34.7ns 125ns 0 0 0 4.68 KB
master RunWafRealisticBenchmarkWithAttack net6.0 288μs 48.4ns 175ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 298μs 163ns 610ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 314μs 27.5ns 99.2ns 0 0 0 2.29 KB
#7720 RunWafRealisticBenchmark net6.0 392μs 79ns 306ns 0 0 0 4.56 KB
#7720 RunWafRealisticBenchmark netcoreapp3.1 857μs 4.15μs 16.6μs 0 0 0 4.48 KB
#7720 RunWafRealisticBenchmark net472 428μs 47.9ns 179ns 0 0 0 4.66 KB
#7720 RunWafRealisticBenchmarkWithAttack net6.0 284μs 89.7ns 347ns 0 0 0 2.24 KB
#7720 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 724μs 5.66μs 53.1μs 0 0 0 2.22 KB
#7720 RunWafRealisticBenchmarkWithAttack net472 309μs 44.3ns 172ns 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 61μs 63.7ns 229ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 71.9μs 65ns 243ns 0 0 0 17.42 KB
master SendRequest net472 0.000221ns 0.000221ns 0.000858ns 0 0 0 0 b
#7720 SendRequest net6.0 60.9μs 86.5ns 324ns 0 0 0 14.52 KB
#7720 SendRequest netcoreapp3.1 72.5μs 264ns 1.12μs 0 0 0 17.42 KB
#7720 SendRequest net472 0.00615ns 0.00218ns 0.00843ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Same speed :heavy_check_mark: More allocations :warning:

More allocations :warning: in #7720

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 6 B 7 B 1 B 16.67%

Fewer allocations :tada: in #7720

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 5 B 4 B -1 B -20.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 73 B 0 b -73 B -100.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 48 B 0 b -48 B -100.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.93ms 2.64μs 10.2μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.28ms 11.6μs 53.3μs 0 0 0 640.09 KB
master OriginalCharSlice net472 2.63ms 703ns 2.54μs 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.41ms 104ns 403ns 0 0 0 6 B
master OptimizedCharSlice netcoreapp3.1 1.75ms 479ns 1.85μs 0 0 0 1 B
master OptimizedCharSlice net472 1.94ms 270ns 1.04μs 0 0 0 73 B
master OptimizedCharSliceWithPool net6.0 875μs 116ns 450ns 0 0 0 5 B
master OptimizedCharSliceWithPool netcoreapp3.1 798μs 124ns 480ns 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.13ms 102ns 397ns 0 0 0 48 B
#7720 OriginalCharSlice net6.0 1.93ms 304ns 1.18μs 0 0 0 640.01 KB
#7720 OriginalCharSlice netcoreapp3.1 2.08ms 5.51μs 21.3μs 0 0 0 640 KB
#7720 OriginalCharSlice net472 2.76ms 392ns 1.41μs 100 0 0 641.95 KB
#7720 OptimizedCharSlice net6.0 1.36ms 387ns 1.5μs 0 0 0 7 B
#7720 OptimizedCharSlice netcoreapp3.1 1.72ms 128ns 463ns 0 0 0 1 B
#7720 OptimizedCharSlice net472 1.97ms 250ns 969ns 0 0 0 0 b
#7720 OptimizedCharSliceWithPool net6.0 874μs 24.5ns 91.7ns 0 0 0 4 B
#7720 OptimizedCharSliceWithPool netcoreapp3.1 851μs 32.3ns 125ns 0 0 0 0 b
#7720 OptimizedCharSliceWithPool net472 1.16ms 128ns 494ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed :heavy_check_mark: Fewer allocations :tada:

Fewer allocations :tada: in #7720

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 42.6 KB 41.8 KB -800 B -1.88%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 665μs 2.63μs 9.85μs 0 0 0 42.6 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 640μs 2.96μs 10.7μs 0 0 0 41.96 KB
master WriteAndFlushEnrichedTraces net472 978μs 4.14μs 16μs 8.33 0 0 56.56 KB
#7720 WriteAndFlushEnrichedTraces net6.0 741μs 3.16μs 11.8μs 0 0 0 41.8 KB
#7720 WriteAndFlushEnrichedTraces netcoreapp3.1 709μs 2.87μs 11.1μs 0 0 0 41.89 KB
#7720 WriteAndFlushEnrichedTraces net472 939μs 4.62μs 19.6μs 8.93 4.46 0 56.61 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.83μs 9.13ns 38.7ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.6μs 8.02ns 31ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.88μs 4.02ns 16.1ns 0.143 0.0143 0 987 B
#7720 ExecuteNonQuery net6.0 1.96μs 8.04ns 30.1ns 0 0 0 1.02 KB
#7720 ExecuteNonQuery netcoreapp3.1 2.66μs 6.47ns 25.1ns 0 0 0 1.02 KB
#7720 ExecuteNonQuery net472 2.83μs 2.55ns 9.2ns 0.156 0.0142 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.67μs 7.01ns 26.2ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.21μs 10.3ns 41.2ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.65μs 1.73ns 6.69ns 0.164 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.86μs 8.41ns 31.5ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.34μs 10.7ns 41.5ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.85μs 5.9ns 22.9ns 0.171 0 0 1.1 KB
#7720 CallElasticsearch net6.0 1.73μs 5.96ns 23.1ns 0 0 0 1.03 KB
#7720 CallElasticsearch netcoreapp3.1 2.19μs 10.9ns 44.9ns 0 0 0 1.03 KB
#7720 CallElasticsearch net472 3.62μs 5.98ns 23.2ns 0.163 0 0 1.04 KB
#7720 CallElasticsearchAsync net6.0 1.88μs 5.28ns 19ns 0 0 0 1.01 KB
#7720 CallElasticsearchAsync netcoreapp3.1 2.36μs 11ns 43.9ns 0 0 0 1.08 KB
#7720 CallElasticsearchAsync net472 3.69μs 6.74ns 26.1ns 0.166 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.84μs 6.75ns 24.4ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.5μs 8.39ns 32.5ns 0 0 0 952 B
master ExecuteAsync net472 2.62μs 5.25ns 20.4ns 0.143 0 0 915 B
#7720 ExecuteAsync net6.0 1.85μs 1.68ns 5.81ns 0 0 0 952 B
#7720 ExecuteAsync netcoreapp3.1 2.54μs 4.61ns 17.9ns 0 0 0 952 B
#7720 ExecuteAsync net472 2.63μs 6.18ns 23.9ns 0.143 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 7.06μs 16.7ns 62.4ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.43μs 6.39ns 23ns 0 0 0 2.9 KB
master SendAsync net472 12.3μs 13.9ns 53.6ns 0.491 0 0 3.18 KB
#7720 SendAsync net6.0 6.85μs 24.5ns 95ns 0 0 0 2.36 KB
#7720 SendAsync netcoreapp3.1 8.65μs 6.92ns 26.8ns 0 0 0 2.9 KB
#7720 SendAsync net472 12.2μs 11.6ns 45.1ns 0.487 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed :heavy_check_mark: More allocations :warning:

More allocations :warning: in #7720

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.44 KB 68.25 KB 24.81 KB 57.11%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 254.69 KB 276.17 KB 21.48 KB 8.43%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 278.53 KB 286.72 KB 8.19 KB 2.94%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 43.63 KB 44.13 KB 496 B 1.14%

Fewer allocations :tada: in #7720

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 65.54 KB 57.34 KB -8.19 KB -12.50%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 41.4μs 164ns 570ns 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 49.1μs 256ns 1.17μs 0 0 0 43.63 KB
master StringConcatBenchmark net472 58.4μs 270ns 1.05μs 0 0 0 65.54 KB
master StringConcatAspectBenchmark net6.0 501μs 1.84μs 7.37μs 0 0 0 277.94 KB
master StringConcatAspectBenchmark netcoreapp3.1 491μs 1.67μs 6.26μs 0 0 0 254.69 KB
master StringConcatAspectBenchmark net472 405μs 2.17μs 11.3μs 0 0 0 278.53 KB
#7720 StringConcatBenchmark net6.0 45μs 263ns 2.38μs 0 0 0 68.25 KB
#7720 StringConcatBenchmark netcoreapp3.1 56.1μs 750ns 7.39μs 0 0 0 44.13 KB
#7720 StringConcatBenchmark net472 57.6μs 137ns 492ns 0 0 0 57.34 KB
#7720 StringConcatAspectBenchmark net6.0 481μs 1.96μs 7.08μs 0 0 0 276.98 KB
#7720 StringConcatAspectBenchmark netcoreapp3.1 517μs 1.73μs 6.94μs 0 0 0 276.17 KB
#7720 StringConcatAspectBenchmark net472 395μs 1.29μs 4.47μ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.71μs 12.6ns 50.5ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.52μs 15.8ns 61.1ns 0 0 0 1.7 KB
master EnrichedLog net472 3.81μs 2.01ns 7.77ns 0.247 0 0 1.64 KB
#7720 EnrichedLog net6.0 2.72μs 2.73ns 10.6ns 0 0 0 1.7 KB
#7720 EnrichedLog netcoreapp3.1 3.68μs 18.1ns 80.8ns 0 0 0 1.7 KB
#7720 EnrichedLog net472 3.83μs 3.15ns 12.2ns 0.249 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 129μs 492ns 1.84μs 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 130μs 265ns 954ns 0 0 0 4.31 KB
master EnrichedLog net472 168μs 155ns 581ns 0 0 0 4.52 KB
#7720 EnrichedLog net6.0 124μs 102ns 367ns 0 0 0 4.31 KB
#7720 EnrichedLog netcoreapp3.1 129μs 406ns 1.52μs 0 0 0 4.31 KB
#7720 EnrichedLog net472 170μs 427ns 1.65μs 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.02μs 17.4ns 65.2ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.68μs 13.5ns 52.1ns 0 0 0 2.26 KB
master EnrichedLog net472 7.53μs 5.43ns 21ns 0.299 0 0 2.08 KB
#7720 EnrichedLog net6.0 5.11μs 24.6ns 95.3ns 0 0 0 2.26 KB
#7720 EnrichedLog netcoreapp3.1 7.02μs 10.6ns 41.1ns 0 0 0 2.26 KB
#7720 EnrichedLog net472 7.72μs 4.87ns 18.9ns 0.308 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.95μs 10.6ns 54.1ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.62μs 12.4ns 52.6ns 0 0 0 1.2 KB
master SendReceive net472 3.02μs 2.72ns 10.5ns 0.18 0 0 1.2 KB
#7720 SendReceive net6.0 1.96μs 1.78ns 6.65ns 0 0 0 1.2 KB
#7720 SendReceive netcoreapp3.1 2.68μs 3.76ns 14.6ns 0 0 0 1.2 KB
#7720 SendReceive net472 2.97μs 2.24ns 8.68ns 0.177 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.3μs 7.02ns 27.2ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.65μs 17.4ns 67.5ns 0 0 0 1.63 KB
master EnrichedLog net472 6.59μs 7.7ns 28.8ns 0.295 0 0 2.03 KB
#7720 EnrichedLog net6.0 4.4μs 3.41ns 13.2ns 0 0 0 1.58 KB
#7720 EnrichedLog netcoreapp3.1 5.66μs 8.37ns 32.4ns 0 0 0 1.63 KB
#7720 EnrichedLog net472 6.69μs 9.17ns 35.5ns 0.299 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 768ns 4ns 19.6ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 953ns 4.91ns 24.1ns 0 0 0 576 B
master StartFinishSpan net472 947ns 0.2ns 0.72ns 0.09 0 0 578 B
master StartFinishScope net6.0 922ns 0.233ns 0.904ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.2μs 4.69ns 18.1ns 0 0 0 696 B
master StartFinishScope net472 1.15μs 0.245ns 0.882ns 0.103 0 0 658 B
#7720 StartFinishSpan net6.0 773ns 3.85ns 17.2ns 0 0 0 576 B
#7720 StartFinishSpan netcoreapp3.1 964ns 4.91ns 23.5ns 0 0 0 576 B
#7720 StartFinishSpan net472 956ns 0.12ns 0.447ns 0.0906 0 0 578 B
#7720 StartFinishScope net6.0 930ns 0.548ns 2.12ns 0 0 0 696 B
#7720 StartFinishScope netcoreapp3.1 1.23μs 6.13ns 28.1ns 0 0 0 696 B
#7720 StartFinishScope net472 1.17μs 0.194ns 0.724ns 0.099 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.08μs 5.04ns 20.1ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.41μs 6.88ns 31.5ns 0 0 0 696 B
master RunOnMethodBegin net472 1.49μs 0.871ns 3.37ns 0.104 0 0 658 B
#7720 RunOnMethodBegin net6.0 1.07μs 5.21ns 20.9ns 0 0 0 696 B
#7720 RunOnMethodBegin netcoreapp3.1 1.4μs 6.63ns 25.7ns 0 0 0 696 B
#7720 RunOnMethodBegin net472 1.49μs 0.568ns 2.2ns 0.104 0 0 658 B

pr-commenter[bot] avatar Oct 28 '25 14:10 pr-commenter[bot]