- 
                Notifications
    You must be signed in to change notification settings 
- Fork 150
          Check if httpContext.Response is not null
          #7720
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes me so sad we have to handle this. HttpContext.Response is non-null by definition 🙁
        
          
                tracer/src/Datadog.Trace/DiagnosticListeners/AspNetCoreDiagnosticObserver.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
| 
 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? | 
| BenchmarksBenchmarks Report for benchmark platform 🐌Benchmarks for #7720 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 ✔️ Same allocations ✔️Raw results
 Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
 Benchmarks.Trace.Asm.AppSecBodyBenchmark - Unknown 🤷 Same allocations ✔️Raw results
 Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️Raw results
 Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower  | 
| 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 ✔️ Same allocations ✔️
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 ✔️ More allocations ⚠️ 
More allocations ⚠️  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 🎉 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% 
 
| Benchmark | Base Allocated | Diff Allocated | Change | Change % | 
|---|---|---|---|---|
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 | 6 B | 7 B | 1 B | 16.67% | 
| 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 ✔️ Fewer allocations 🎉
Fewer allocations 🎉 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% 
 
| 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 ✔️ Same allocations ✔️
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 ✔️ Same allocations ✔️
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 ✔️ Same allocations ✔️
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 ✔️ Same allocations ✔️
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 ✔️ More allocations ⚠️ 
More allocations ⚠️  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 🎉 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% 
 
| 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% | 
| 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 ✔️ Same allocations ✔️
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 ✔️ Same allocations ✔️
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 ✔️ Same allocations ✔️
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 ✔️ Same allocations ✔️
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 ✔️ Same allocations ✔️
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 ✔️ Same allocations ✔️
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 ✔️ Same allocations ✔️
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 | 
Summary of changes
Saw a couple of of
NullReferenceExceptionfrom calling things inHttpContext.Response.so checking ifResponseis notnullReason for change
Implementation details
Added some null checks / protections
Test coverage
Looked at
dd-trace-dotnet/tracer/test/Datadog.Trace.Tests/PlatformHelpers/AspNetCoreHttpRequestHandlerTests.cs
Line 15 in 5f33ec0
Other details