-
Notifications
You must be signed in to change notification settings - Fork 150
Handle disposed Cosmos clients gracefully #7700
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
Co-authored-by: bouwkast <[email protected]>
|
Bits AI Dev Agent Status: ✅ Done [Fix CI Errors] You can ask for changes by mentioning @DataDog in a comment. |
|
I would like to ideally search for duck typing an IsDisposed property/field if it is available |
Execution-Time Benchmarks Report ⏱️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:
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 (7700) - mean (75ms) : 73, 76
. : milestone, 75,
master - mean (74ms) : 73, 76
. : milestone, 74,
section Baseline
This PR (7700) - mean (70ms) : 68, 72
. : milestone, 70,
master - mean (70ms) : 68, 72
. : milestone, 70,
section CallTarget+Inlining+NGEN
This PR (7700) - mean (1,061ms) : 1005, 1116
. : milestone, 1061,
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 (7700) - mean (111ms) : 107, 115
. : milestone, 111,
master - mean (110ms) : 108, 112
. : milestone, 110,
section Baseline
This PR (7700) - mean (109ms) : 106, 113
. : milestone, 109,
master - mean (109ms) : 104, 115
. : milestone, 109,
section CallTarget+Inlining+NGEN
This PR (7700) - mean (759ms) : 735, 784
. : milestone, 759,
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 (7700) - mean (98ms) : 96, 100
. : milestone, 98,
master - mean (98ms) : 96, 100
. : milestone, 98,
section Baseline
This PR (7700) - mean (97ms) : 94, 100
. : milestone, 97,
master - mean (97ms) : 94, 100
. : milestone, 97,
section CallTarget+Inlining+NGEN
This PR (7700) - mean (720ms) : 675, 765
. : milestone, 720,
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 (7700) - mean (98ms) : 95, 100
. : milestone, 98,
master - mean (97ms) : 95, 99
. : milestone, 97,
section Baseline
This PR (7700) - mean (97ms) : 93, 102
. : milestone, 97,
master - mean (96ms) : 93, 98
. : milestone, 96,
section CallTarget+Inlining+NGEN
This PR (7700) - mean (676ms) : 653, 699
. : milestone, 676,
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 (7700) - mean (197ms) : 195, 199
. : milestone, 197,
master - mean (197ms) : 194, 200
. : milestone, 197,
section Baseline
This PR (7700) - mean (194ms) : 191, 198
. : milestone, 194,
master - mean (193ms) : 189, 198
. : milestone, 193,
section CallTarget+Inlining+NGEN
This PR (7700) - mean (1,170ms) : 1108, 1232
. : milestone, 1170,
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 (7700) - mean (278ms) : 274, 282
. : milestone, 278,
master - mean (280ms) : 274, 286
. : milestone, 280,
section Baseline
This PR (7700) - mean (278ms) : 274, 283
. : milestone, 278,
master - mean (280ms) : 271, 288
. : milestone, 280,
section CallTarget+Inlining+NGEN
This PR (7700) - mean (950ms) : 910, 989
. : milestone, 950,
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 (7700) - mean (271ms) : 267, 275
. : milestone, 271,
master - mean (271ms) : 267, 275
. : milestone, 271,
section Baseline
This PR (7700) - mean (272ms) : 267, 277
. : milestone, 272,
master - mean (292ms) : 228, 356
. : milestone, 292,
section CallTarget+Inlining+NGEN
This PR (7700) - mean (937ms) : 894, 980
. : milestone, 937,
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 (7700) - mean (271ms) : 267, 275
. : milestone, 271,
master - mean (270ms) : 267, 274
. : milestone, 270,
section Baseline
This PR (7700) - mean (271ms) : 266, 276
. : milestone, 271,
master - mean (271ms) : 266, 276
. : milestone, 271,
section CallTarget+Inlining+NGEN
This PR (7700) - mean (858ms) : 838, 878
. : milestone, 858,
master - mean (863ms) : 837, 888
. : milestone, 863,
|
BenchmarksBenchmarks Report for benchmark platform 🐌Benchmarks for #7700 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 | 6.07 KB | 6.13 KB | 57 B | 0.94% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net6.0 | 5.52 KB | 5.4 KB | -120 B | -2.17% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartStopWithChild |
net6.0 | 10.6μs | 55.3ns | 271ns | 0 | 0 | 0 | 5.52 KB |
| master | StartStopWithChild |
netcoreapp3.1 | 14μs | 58.6ns | 227ns | 0 | 0 | 0 | 5.71 KB |
| master | StartStopWithChild |
net472 | 22μs | 101ns | 392ns | 0.858 | 0.214 | 0 | 6.07 KB |
| #7700 | StartStopWithChild |
net6.0 | 10.5μs | 59.4ns | 389ns | 0 | 0 | 0 | 5.4 KB |
| #7700 | StartStopWithChild |
netcoreapp3.1 | 13.7μs | 69.6ns | 334ns | 0 | 0 | 0 | 5.71 KB |
| #7700 | StartStopWithChild |
net472 | 22.5μs | 122ns | 709ns | 0.933 | 0.311 | 0 | 6.13 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 | 930μs | 71.2ns | 266ns | 0 | 0 | 0 | 2.71 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.03ms | 365ns | 1.42μs | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 1.19ms | 1.22μs | 4.74μs | 0 | 0 | 0 | 3.31 KB |
| #7700 | WriteAndFlushEnrichedTraces |
net6.0 | 926μs | 128ns | 460ns | 0 | 0 | 0 | 2.71 KB |
| #7700 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.01ms | 281ns | 1.09μs | 0 | 0 | 0 | 2.7 KB |
| #7700 | WriteAndFlushEnrichedTraces |
net472 | 1.22ms | 121ns | 468ns | 0 | 0 | 0 | 3.31 KB |
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Unknown 🤷 Same allocations ✔️
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 | 316ns | 1.8ns | 12.7ns | 0 | 0 | 0 | 280 B |
| master | ObjectExtractorSimpleBody |
netcoreapp3.1 | 400ns | 2.15ns | 11.4ns | 0 | 0 | 0 | 272 B |
| master | ObjectExtractorSimpleBody |
net472 | 299ns | 0.0591ns | 0.229ns | 0.0437 | 0 | 0 | 281 B |
| master | ObjectExtractorMoreComplexBody |
net6.0 | 6.28μs | 28.9ns | 112ns | 0 | 0 | 0 | 3.78 KB |
| master | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.67μs | 35.4ns | 146ns | 0 | 0 | 0 | 3.69 KB |
| master | ObjectExtractorMoreComplexBody |
net472 | 6.76μs | 7.11ns | 27.5ns | 0.571 | 0 | 0 | 3.8 KB |
| #7700 | AllCycleSimpleBody |
net6.0 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7700 | AllCycleSimpleBody |
netcoreapp3.1 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7700 | AllCycleSimpleBody |
net472 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7700 | AllCycleMoreComplexBody |
net6.0 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7700 | AllCycleMoreComplexBody |
netcoreapp3.1 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7700 | AllCycleMoreComplexBody |
net472 | N/A | N/A | N/A | NaN | NaN | NaN | 0 b |
| #7700 | ObjectExtractorSimpleBody |
net6.0 | 320ns | 1.61ns | 6.82ns | 0 | 0 | 0 | 280 B |
| #7700 | ObjectExtractorSimpleBody |
netcoreapp3.1 | 406ns | 0.354ns | 1.37ns | 0 | 0 | 0 | 272 B |
| #7700 | ObjectExtractorSimpleBody |
net472 | 295ns | 0.0911ns | 0.353ns | 0.0446 | 0 | 0 | 281 B |
| #7700 | ObjectExtractorMoreComplexBody |
net6.0 | 6.27μs | 29.5ns | 110ns | 0 | 0 | 0 | 3.78 KB |
| #7700 | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.86μs | 27.1ns | 105ns | 0 | 0 | 0 | 3.69 KB |
| #7700 | ObjectExtractorMoreComplexBody |
net472 | 6.73μs | 2.44ns | 9.45ns | 0.571 | 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.3μs | 180ns | 697ns | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
netcoreapp3.1 | 96.7μs | 131ns | 507ns | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
net472 | 109μs | 9.68ns | 37.5ns | 4.91 | 0 | 0 | 32.51 KB |
| master | EncodeLegacyArgs |
net6.0 | 145μs | 20.7ns | 74.5ns | 0 | 0 | 0 | 2.15 KB |
| master | EncodeLegacyArgs |
netcoreapp3.1 | 199μs | 249ns | 964ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
net472 | 261μs | 57.3ns | 214ns | 0 | 0 | 0 | 2.16 KB |
| #7700 | EncodeArgs |
net6.0 | 77.1μs | 67.3ns | 252ns | 0 | 0 | 0 | 32.4 KB |
| #7700 | EncodeArgs |
netcoreapp3.1 | 96.9μs | 196ns | 759ns | 0 | 0 | 0 | 32.4 KB |
| #7700 | EncodeArgs |
net472 | 109μs | 12.6ns | 47.2ns | 4.89 | 0 | 0 | 32.51 KB |
| #7700 | EncodeLegacyArgs |
net6.0 | 145μs | 9.03ns | 32.6ns | 0 | 0 | 0 | 2.14 KB |
| #7700 | EncodeLegacyArgs |
netcoreapp3.1 | 197μs | 264ns | 1.02μs | 0 | 0 | 0 | 2.15 KB |
| #7700 | EncodeLegacyArgs |
net472 | 263μs | 62.7ns | 235ns | 0 | 0 | 0 | 2.17 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 | 395μs | 67.9ns | 254ns | 0 | 0 | 0 | 4.56 KB |
| master | RunWafRealisticBenchmark |
netcoreapp3.1 | 412μs | 84.6ns | 305ns | 0 | 0 | 0 | 4.48 KB |
| master | RunWafRealisticBenchmark |
net472 | 425μs | 49.2ns | 190ns | 0 | 0 | 0 | 4.66 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 285μs | 58.1ns | 218ns | 0 | 0 | 0 | 2.24 KB |
| master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 297μs | 193ns | 723ns | 0 | 0 | 0 | 2.22 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net472 | 309μs | 38.7ns | 150ns | 0 | 0 | 0 | 2.29 KB |
| #7700 | RunWafRealisticBenchmark |
net6.0 | 396μs | 98.2ns | 380ns | 0 | 0 | 0 | 4.55 KB |
| #7700 | RunWafRealisticBenchmark |
netcoreapp3.1 | 407μs | 57.1ns | 198ns | 0 | 0 | 0 | 4.48 KB |
| #7700 | RunWafRealisticBenchmark |
net472 | 427μs | 51.8ns | 201ns | 0 | 0 | 0 | 4.66 KB |
| #7700 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 285μs | 48.8ns | 183ns | 0 | 0 | 0 | 2.24 KB |
| #7700 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 298μs | 24.8ns | 96ns | 0 | 0 | 0 | 2.22 KB |
| #7700 | RunWafRealisticBenchmarkWithAttack |
net472 | 309μs | 43ns | 149ns | 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.3μs | 61.4ns | 238ns | 0 | 0 | 0 | 14.52 KB |
| master | SendRequest |
netcoreapp3.1 | 70.9μs | 186ns | 672ns | 0 | 0 | 0 | 17.42 KB |
| master | SendRequest |
net472 | 3.56E‑05ns | 3.56E‑05ns | 0.000138ns | 0 | 0 | 0 | 0 b |
| #7700 | SendRequest |
net6.0 | 61.4μs | 276ns | 1.14μs | 0 | 0 | 0 | 14.52 KB |
| #7700 | SendRequest |
netcoreapp3.1 | 72.3μs | 335ns | 1.3μs | 0 | 0 | 0 | 17.42 KB |
| #7700 | SendRequest |
net472 | 0.00291ns | 0.00136ns | 0.00525ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CharSliceBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7700
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‑net6.0
7 B
4 B
-3 B
-42.86%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472
73 B
0 b
-73 B
-100.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1
6 B
0 b
-6 B
-100.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472
47 B
0 b
-47 B
-100.00%
| 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‑net6.0 | 7 B | 4 B | -3 B | -42.86% |
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 | 73 B | 0 b | -73 B | -100.00% |
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 | 6 B | 0 b | -6 B | -100.00% |
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 | 47 B | 0 b | -47 B | -100.00% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | OriginalCharSlice |
net6.0 | 1.91ms | 1.12μs | 4.04μs | 0 | 0 | 0 | 640.01 KB |
| master | OriginalCharSlice |
netcoreapp3.1 | 2.17ms | 8.08μs | 30.2μs | 0 | 0 | 0 | 640 KB |
| master | OriginalCharSlice |
net472 | 2.57ms | 107ns | 401ns | 100 | 0 | 0 | 641.95 KB |
| master | OptimizedCharSlice |
net6.0 | 1.35ms | 247ns | 956ns | 0 | 0 | 0 | 7 B |
| master | OptimizedCharSlice |
netcoreapp3.1 | 1.7ms | 385ns | 1.49μs | 0 | 0 | 0 | 1 B |
| master | OptimizedCharSlice |
net472 | 1.93ms | 433ns | 1.68μs | 0 | 0 | 0 | 73 B |
| master | OptimizedCharSliceWithPool |
net6.0 | 836μs | 41.6ns | 156ns | 0 | 0 | 0 | 5 B |
| master | OptimizedCharSliceWithPool |
netcoreapp3.1 | 855μs | 148ns | 573ns | 0 | 0 | 0 | 6 B |
| master | OptimizedCharSliceWithPool |
net472 | 1.16ms | 140ns | 504ns | 0 | 0 | 0 | 47 B |
| #7700 | OriginalCharSlice |
net6.0 | 1.9ms | 2.94μs | 11.4μs | 0 | 0 | 0 | 640.01 KB |
| #7700 | OriginalCharSlice |
netcoreapp3.1 | 2.21ms | 10.1μs | 40.3μs | 0 | 0 | 0 | 640 KB |
| #7700 | OriginalCharSlice |
net472 | 2.56ms | 195ns | 756ns | 100 | 0 | 0 | 641.95 KB |
| #7700 | OptimizedCharSlice |
net6.0 | 1.39ms | 410ns | 1.53μs | 0 | 0 | 0 | 4 B |
| #7700 | OptimizedCharSlice |
netcoreapp3.1 | 1.7ms | 421ns | 1.57μs | 0 | 0 | 0 | 1 B |
| #7700 | OptimizedCharSlice |
net472 | 1.89ms | 248ns | 961ns | 0 | 0 | 0 | 0 b |
| #7700 | OptimizedCharSliceWithPool |
net6.0 | 819μs | 43.2ns | 162ns | 0 | 0 | 0 | 4 B |
| #7700 | OptimizedCharSliceWithPool |
netcoreapp3.1 | 879μs | 144ns | 559ns | 0 | 0 | 0 | 0 b |
| #7700 | OptimizedCharSliceWithPool |
net472 | 1.15ms | 224ns | 866ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #7700
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1
41.75 KB
42.03 KB
277 B
0.66%
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472
55.66 KB
55.95 KB
288 B
0.52%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 | 41.75 KB | 42.03 KB | 277 B | 0.66% |
| Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 | 55.66 KB | 55.95 KB | 288 B | 0.52% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 753μs | 2.32μs | 9μs | 0 | 0 | 0 | 41.89 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 719μs | 2.26μs | 8.47μs | 0 | 0 | 0 | 41.75 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 907μs | 2.35μs | 8.8μs | 4.46 | 0 | 0 | 55.66 KB |
| #7700 | WriteAndFlushEnrichedTraces |
net6.0 | 702μs | 2.03μs | 7.86μs | 0 | 0 | 0 | 41.71 KB |
| #7700 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 648μs | 3.26μs | 15.3μs | 0 | 0 | 0 | 42.03 KB |
| #7700 | WriteAndFlushEnrichedTraces |
net472 | 889μs | 3.74μs | 14.5μs | 8.33 | 0 | 0 | 55.95 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.97μs | 5.96ns | 23.1ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
netcoreapp3.1 | 2.61μs | 7.33ns | 28.4ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
net472 | 2.76μs | 3.59ns | 13.9ns | 0.151 | 0.0137 | 0 | 987 B |
| #7700 | ExecuteNonQuery |
net6.0 | 1.93μs | 9.85ns | 48.3ns | 0 | 0 | 0 | 1.02 KB |
| #7700 | ExecuteNonQuery |
netcoreapp3.1 | 2.68μs | 12.9ns | 53.1ns | 0 | 0 | 0 | 1.02 KB |
| #7700 | ExecuteNonQuery |
net472 | 2.77μs | 3.23ns | 11.6ns | 0.153 | 0.0139 | 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.69μs | 7.66ns | 28.7ns | 0 | 0 | 0 | 1.03 KB |
| master | CallElasticsearch |
netcoreapp3.1 | 2.19μs | 7.77ns | 30.1ns | 0 | 0 | 0 | 1.03 KB |
| master | CallElasticsearch |
net472 | 3.55μs | 1.98ns | 7.4ns | 0.161 | 0 | 0 | 1.04 KB |
| master | CallElasticsearchAsync |
net6.0 | 1.94μs | 1.98ns | 7.4ns | 0 | 0 | 0 | 1.01 KB |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 2.44μs | 11ns | 42.5ns | 0 | 0 | 0 | 1.08 KB |
| master | CallElasticsearchAsync |
net472 | 3.62μs | 2.47ns | 9.25ns | 0.163 | 0 | 0 | 1.1 KB |
| #7700 | CallElasticsearch |
net6.0 | 1.72μs | 7.22ns | 27ns | 0 | 0 | 0 | 1.03 KB |
| #7700 | CallElasticsearch |
netcoreapp3.1 | 2.25μs | 8.02ns | 31.1ns | 0 | 0 | 0 | 1.03 KB |
| #7700 | CallElasticsearch |
net472 | 3.49μs | 2.11ns | 8.18ns | 0.158 | 0 | 0 | 1.04 KB |
| #7700 | CallElasticsearchAsync |
net6.0 | 1.81μs | 0.62ns | 2.32ns | 0 | 0 | 0 | 1.01 KB |
| #7700 | CallElasticsearchAsync |
netcoreapp3.1 | 2.33μs | 11.8ns | 49.9ns | 0 | 0 | 0 | 1.08 KB |
| #7700 | CallElasticsearchAsync |
net472 | 3.69μs | 1.92ns | 7.17ns | 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 | 2.04μs | 6.49ns | 25.1ns | 0 | 0 | 0 | 952 B |
| master | ExecuteAsync |
netcoreapp3.1 | 2.47μs | 9.32ns | 36.1ns | 0 | 0 | 0 | 952 B |
| master | ExecuteAsync |
net472 | 2.68μs | 1.49ns | 5.77ns | 0.134 | 0 | 0 | 915 B |
| #7700 | ExecuteAsync |
net6.0 | 1.85μs | 9.3ns | 39.5ns | 0 | 0 | 0 | 952 B |
| #7700 | ExecuteAsync |
netcoreapp3.1 | 2.44μs | 10.1ns | 39.1ns | 0 | 0 | 0 | 952 B |
| #7700 | ExecuteAsync |
net472 | 2.63μs | 1.51ns | 5.86ns | 0.145 | 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 | 6.83μs | 17.1ns | 64.1ns | 0 | 0 | 0 | 2.36 KB |
| master | SendAsync |
netcoreapp3.1 | 8.79μs | 13.8ns | 53.3ns | 0 | 0 | 0 | 2.9 KB |
| master | SendAsync |
net472 | 12.3μs | 9.71ns | 37.6ns | 0.493 | 0 | 0 | 3.18 KB |
| #7700 | SendAsync |
net6.0 | 6.94μs | 18.1ns | 70.1ns | 0 | 0 | 0 | 2.36 KB |
| #7700 | SendAsync |
netcoreapp3.1 | 8.73μs | 25ns | 96.8ns | 0 | 0 | 0 | 2.9 KB |
| #7700 | SendAsync |
net472 | 12.5μs | 12.7ns | 49ns | 0.497 | 0 | 0 | 3.18 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #7700
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0
256.02 KB
259.33 KB
3.3 KB
1.29%
Fewer allocations 🎉 in #7700
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0
44.5 KB
44.18 KB
-328 B
-0.74%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472
286.72 KB
278.53 KB
-8.19 KB
-2.86%
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.StringConcatAspectBenchmark‑net6.0 | 256.02 KB | 259.33 KB | 3.3 KB | 1.29% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 | 44.5 KB | 44.18 KB | -328 B | -0.74% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 | 286.72 KB | 278.53 KB | -8.19 KB | -2.86% |
| 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 | 43.9μs | 180ns | 721ns | 0 | 0 | 0 | 44.5 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 46.8μs | 217ns | 813ns | 0 | 0 | 0 | 42.64 KB |
| master | StringConcatBenchmark |
net472 | 56.3μs | 260ns | 974ns | 0 | 0 | 0 | 65.54 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 449μs | 1.56μs | 5.83μs | 0 | 0 | 0 | 256.02 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 485μs | 1.22μs | 4.4μs | 0 | 0 | 0 | 254.53 KB |
| master | StringConcatAspectBenchmark |
net472 | 399μs | 1.76μs | 6.57μs | 0 | 0 | 0 | 286.72 KB |
| #7700 | StringConcatBenchmark |
net6.0 | 45.5μs | 216ns | 863ns | 0 | 0 | 0 | 44.18 KB |
| #7700 | StringConcatBenchmark |
netcoreapp3.1 | 50.2μs | 290ns | 2.29μs | 0 | 0 | 0 | 42.8 KB |
| #7700 | StringConcatBenchmark |
net472 | 57.1μs | 264ns | 1.02μs | 0 | 0 | 0 | 57.34 KB |
| #7700 | StringConcatAspectBenchmark |
net6.0 | 440μs | 1.53μs | 5.52μs | 0 | 0 | 0 | 259.33 KB |
| #7700 | StringConcatAspectBenchmark |
netcoreapp3.1 | 495μs | 1.37μs | 5.12μs | 0 | 0 | 0 | 255.49 KB |
| #7700 | StringConcatAspectBenchmark |
net472 | 400μs | 1.73μs | 6.9μs | 0 | 0 | 0 | 278.53 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.61μs | 1.08ns | 4.17ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.6μs | 14.9ns | 57.9ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
net472 | 3.9μs | 2.82ns | 10.9ns | 0.254 | 0 | 0 | 1.64 KB |
| #7700 | EnrichedLog |
net6.0 | 2.64μs | 13ns | 53.5ns | 0 | 0 | 0 | 1.7 KB |
| #7700 | EnrichedLog |
netcoreapp3.1 | 3.56μs | 17.9ns | 84.2ns | 0 | 0 | 0 | 1.7 KB |
| #7700 | EnrichedLog |
net472 | 3.84μs | 2.66ns | 9.96ns | 0.247 | 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 | 123μs | 22.8ns | 82.4ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
netcoreapp3.1 | 127μs | 49.5ns | 185ns | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
net472 | 167μs | 119ns | 462ns | 0 | 0 | 0 | 4.51 KB |
| #7700 | EnrichedLog |
net6.0 | 121μs | 47.2ns | 170ns | 0 | 0 | 0 | 4.31 KB |
| #7700 | EnrichedLog |
netcoreapp3.1 | 126μs | 69.8ns | 242ns | 0 | 0 | 0 | 4.31 KB |
| #7700 | EnrichedLog |
net472 | 166μs | 34.7ns | 134ns | 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 | 4.93μs | 8ns | 29.9ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.73μs | 17.9ns | 69.4ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
net472 | 7.75μs | 6.16ns | 23.8ns | 0.31 | 0 | 0 | 2.08 KB |
| #7700 | EnrichedLog |
net6.0 | 5.24μs | 13ns | 50.4ns | 0 | 0 | 0 | 2.26 KB |
| #7700 | EnrichedLog |
netcoreapp3.1 | 6.75μs | 6.56ns | 25.4ns | 0 | 0 | 0 | 2.26 KB |
| #7700 | EnrichedLog |
net472 | 7.66μs | 5.04ns | 18.9ns | 0.306 | 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.98μs | 9.85ns | 40.6ns | 0 | 0 | 0 | 1.2 KB |
| master | SendReceive |
netcoreapp3.1 | 2.75μs | 3.7ns | 13.3ns | 0 | 0 | 0 | 1.2 KB |
| master | SendReceive |
net472 | 3.14μs | 3.69ns | 14.3ns | 0.188 | 0 | 0 | 1.2 KB |
| #7700 | SendReceive |
net6.0 | 2.03μs | 10.5ns | 50.2ns | 0 | 0 | 0 | 1.2 KB |
| #7700 | SendReceive |
netcoreapp3.1 | 2.71μs | 4.67ns | 18.1ns | 0 | 0 | 0 | 1.2 KB |
| #7700 | SendReceive |
net472 | 3.1μs | 4.52ns | 17.5ns | 0.182 | 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.4μs | 4.28ns | 16.6ns | 0 | 0 | 0 | 1.58 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.65μs | 14.1ns | 54.6ns | 0 | 0 | 0 | 1.63 KB |
| master | EnrichedLog |
net472 | 6.59μs | 5.55ns | 21.5ns | 0.295 | 0 | 0 | 2.03 KB |
| #7700 | EnrichedLog |
net6.0 | 4.3μs | 12.9ns | 48.4ns | 0 | 0 | 0 | 1.58 KB |
| #7700 | EnrichedLog |
netcoreapp3.1 | 5.65μs | 15.1ns | 58.5ns | 0 | 0 | 0 | 1.63 KB |
| #7700 | EnrichedLog |
net472 | 6.53μs | 8.83ns | 34.2ns | 0.291 | 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 | 782ns | 0.563ns | 2.11ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
netcoreapp3.1 | 968ns | 0.489ns | 1.83ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
net472 | 936ns | 0.436ns | 1.69ns | 0.0889 | 0 | 0 | 578 B |
| master | StartFinishScope |
net6.0 | 901ns | 4.66ns | 22.3ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.18μs | 5.98ns | 27.4ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
net472 | 1.15μs | 0.298ns | 1.15ns | 0.104 | 0 | 0 | 658 B |
| #7700 | StartFinishSpan |
net6.0 | 760ns | 4.05ns | 20.2ns | 0 | 0 | 0 | 576 B |
| #7700 | StartFinishSpan |
netcoreapp3.1 | 942ns | 4.56ns | 17.6ns | 0 | 0 | 0 | 576 B |
| #7700 | StartFinishSpan |
net472 | 953ns | 0.751ns | 2.81ns | 0.0908 | 0 | 0 | 578 B |
| #7700 | StartFinishScope |
net6.0 | 934ns | 3.86ns | 13.4ns | 0 | 0 | 0 | 696 B |
| #7700 | StartFinishScope |
netcoreapp3.1 | 1.19μs | 5.73ns | 24.3ns | 0 | 0 | 0 | 696 B |
| #7700 | StartFinishScope |
net472 | 1.13μs | 0.256ns | 0.991ns | 0.104 | 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.04μs | 5.62ns | 28.6ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.4μs | 5.97ns | 23.1ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.48μs | 1.17ns | 4.04ns | 0.103 | 0 | 0 | 658 B |
| #7700 | RunOnMethodBegin |
net6.0 | 1.13μs | 0.789ns | 3.06ns | 0 | 0 | 0 | 696 B |
| #7700 | RunOnMethodBegin |
netcoreapp3.1 | 1.42μs | 6.95ns | 27.8ns | 0 | 0 | 0 | 696 B |
| #7700 | RunOnMethodBegin |
net472 | 1.43μs | 1.02ns | 3.94ns | 0.0997 | 0 | 0 | 658 B |
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
PR by Bits to fix issue 1f756508-3b0d-11f0-86d3-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
Wrapped all Cosmos client endpoint access in try/catch blocks to handle
ObjectDisposedExceptionwhen the client or container is disposed. Added comprehensive unit tests to verify the instrumentation gracefully handles disposed clients without throwing.Reason for change
The Cosmos DB instrumentation was throwing
ObjectDisposedExceptionwhen attempting to access the client endpoint during span creation if the underlying Cosmos client had been disposed. This caused the CallTarget integration continuation to fail before the scope could be created, breaking instrumentation for disposed clients.More details
The Cosmos DB CallTarget integration eagerly dereferences the Cosmos client while creating span metadata without guarding for disposed instances. In
CosmosCommon.CreateContainerCallStateExtandCreateDatabaseCallStateExt, the code accessedDatabaseNewStruct.Client.EndpointorDatabaseOldStruct.ClientContext.Client.Endpointoutside of a try/catch. When the underlyingMicrosoft.Azure.Cosmosclient was disposed,Microsoft.Azure.Cosmos.ClientContextCore.get_Client()invokedThrowIfDisposed(), throwingObjectDisposedExceptionand causing the integration continuation to fail before scope creation.The fix wraps all endpoint retrieval calls in try/catch blocks to gracefully handle disposal by simply omitting the endpoint when the client is unavailable, allowing instrumentation to continue.
Implementation details
CreateContainerCallStateExtto handleObjectDisposedExceptionwhen accessingDatabaseNewStruct.Client.EndpointandDatabaseOldStruct.ClientContext.Client.EndpointCreateDatabaseCallStateExtfor the same client endpoint accessesCreateCosmosClientCallStateExtto handleObjectDisposedExceptionwhen accessingCosmosClientStruct.EndpointnullwhenObjectDisposedExceptionis caughtTest coverage
Added comprehensive unit tests in
CosmosCommonTests.cs:CreateContainerCallState_DoesNotThrow_WhenDatabaseNewClientDisposed: Verifies no exception when DatabaseNewStruct client is disposedCreateContainerCallState_DoesNotThrow_WhenDatabaseOldClientDisposed: Verifies no exception when DatabaseOldStruct client is disposedCreateDatabaseCallState_DoesNotThrow_WhenClientDisposed_New: Verifies no exception for DatabaseNewStruct disposalCreateDatabaseCallState_DoesNotThrow_WhenClientDisposed_Old: Verifies no exception for DatabaseOldStruct disposalTests use stub classes that simulate disposed clients by throwing
ObjectDisposedExceptionon property access.Other details