Refactor Azure Functions instrumentation before #7628#8079
Refactor Azure Functions instrumentation before #7628#8079lucaspimentel merged 12 commits intomasterfrom
Conversation
bdae1c7 to
67e423e
Compare
cb6304f to
ddd2357
Compare
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8079) and master.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Metric | Master (Mean ± 95% CI) | Current (Mean ± 95% CI) | Change | Status |
|---|---|---|---|---|
| .NET Framework 4.8 - Baseline | ||||
| duration | 68.48 ± (68.49 - 68.75) ms | 77.75 ± (77.70 - 78.09) ms | +13.5% | ❌⬆️ |
| .NET Framework 4.8 - Bailout | ||||
| duration | 72.33 ± (72.20 - 72.41) ms | 82.63 ± (82.45 - 82.87) ms | +14.2% | ❌⬆️ |
| .NET Framework 4.8 - CallTarget+Inlining+NGEN | ||||
| duration | 1005.41 ± (1014.39 - 1025.33) ms | 1087.91 ± (1088.85 - 1098.03) ms | +8.2% | ❌⬆️ |
Full Metrics Comparison
FakeDbCommand
| Metric | Master (Mean ± 95% CI) | Current (Mean ± 95% CI) | Change | Status |
|---|---|---|---|---|
| .NET Framework 4.8 - Baseline | ||||
| duration | 68.48 ± (68.49 - 68.75) ms | 77.75 ± (77.70 - 78.09) ms | +13.5% | ❌⬆️ |
| .NET Framework 4.8 - Bailout | ||||
| duration | 72.33 ± (72.20 - 72.41) ms | 82.63 ± (82.45 - 82.87) ms | +14.2% | ❌⬆️ |
| .NET Framework 4.8 - CallTarget+Inlining+NGEN | ||||
| duration | 1005.41 ± (1014.39 - 1025.33) ms | 1087.91 ± (1088.85 - 1098.03) ms | +8.2% | ❌⬆️ |
| .NET Core 3.1 - Baseline | ||||
| process.internal_duration_ms | 21.86 ± (21.84 - 21.89) ms | 24.14 ± (24.09 - 24.20) ms | +10.4% | ✅⬆️ |
| process.time_to_main_ms | 79.07 ± (78.91 - 79.24) ms | 92.57 ± (92.35 - 92.79) ms | +17.1% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 0 ± (0 - 0) | 0 ± (0 - 0) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 10.91 ± (10.91 - 10.92) MB | 10.91 ± (10.90 - 10.91) MB | -0.1% | ✅ |
| runtime.dotnet.threads.count | 12 ± (12 - 12) | 12 ± (12 - 12) | +0.0% | ✅ |
| .NET Core 3.1 - Bailout | ||||
| process.internal_duration_ms | 21.82 ± (21.80 - 21.84) ms | 23.88 ± (23.83 - 23.94) ms | +9.5% | ✅⬆️ |
| process.time_to_main_ms | 80.23 ± (80.12 - 80.34) ms | 93.16 ± (92.90 - 93.41) ms | +16.1% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 0 ± (0 - 0) | 0 ± (0 - 0) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 10.95 ± (10.95 - 10.96) MB | 10.97 ± (10.96 - 10.97) MB | +0.2% | ✅⬆️ |
| runtime.dotnet.threads.count | 13 ± (13 - 13) | 13 ± (13 - 13) | +0.0% | ✅ |
| .NET Core 3.1 - CallTarget+Inlining+NGEN | ||||
| process.internal_duration_ms | 242.15 ± (238.49 - 245.81) ms | 240.73 ± (237.06 - 244.39) ms | -0.6% | ✅ |
| process.time_to_main_ms | 468.08 ± (467.57 - 468.60) ms | 523.96 ± (523.16 - 524.76) ms | +11.9% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 0 ± (0 - 0) | 0 ± (0 - 0) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 48.34 ± (48.31 - 48.37) MB | 48.26 ± (48.23 - 48.29) MB | -0.2% | ✅ |
| runtime.dotnet.threads.count | 28 ± (28 - 28) | 28 ± (28 - 28) | -0.2% | ✅ |
| .NET 6 - Baseline | ||||
| process.internal_duration_ms | 20.71 ± (20.68 - 20.74) ms | 22.84 ± (22.78 - 22.90) ms | +10.3% | ✅⬆️ |
| process.time_to_main_ms | 68.33 ± (68.24 - 68.43) ms | 81.18 ± (80.98 - 81.39) ms | +18.8% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 0 ± (0 - 0) | 0 ± (0 - 0) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 10.62 ± (10.61 - 10.62) MB | 10.64 ± (10.64 - 10.64) MB | +0.2% | ✅⬆️ |
| runtime.dotnet.threads.count | 10 ± (10 - 10) | 10 ± (10 - 10) | +0.0% | ✅ |
| .NET 6 - Bailout | ||||
| process.internal_duration_ms | 20.62 ± (20.60 - 20.64) ms | 22.56 ± (22.50 - 22.62) ms | +9.4% | ✅⬆️ |
| process.time_to_main_ms | 69.59 ± (69.53 - 69.66) ms | 81.96 ± (81.75 - 82.18) ms | +17.8% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 0 ± (0 - 0) | 0 ± (0 - 0) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 10.73 ± (10.72 - 10.74) MB | 10.75 ± (10.74 - 10.75) MB | +0.2% | ✅⬆️ |
| runtime.dotnet.threads.count | 11 ± (11 - 11) | 11 ± (11 - 11) | +0.0% | ✅ |
| .NET 6 - CallTarget+Inlining+NGEN | ||||
| process.internal_duration_ms | 248.52 ± (246.84 - 250.21) ms | 235.62 ± (231.31 - 239.93) ms | -5.2% | ✅ |
| process.time_to_main_ms | 446.84 ± (446.41 - 447.27) ms | 497.58 ± (496.82 - 498.35) ms | +11.4% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 0 ± (0 - 0) | 0 ± (0 - 0) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 49.26 ± (49.24 - 49.29) MB | 49.02 ± (49.00 - 49.04) MB | -0.5% | ✅ |
| runtime.dotnet.threads.count | 28 ± (28 - 28) | 28 ± (28 - 28) | +0.0% | ✅⬆️ |
| .NET 8 - Baseline | ||||
| process.internal_duration_ms | 18.84 ± (18.82 - 18.87) ms | 20.55 ± (20.50 - 20.60) ms | +9.0% | ✅⬆️ |
| process.time_to_main_ms | 67.56 ± (67.44 - 67.68) ms | 78.66 ± (78.45 - 78.87) ms | +16.4% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 0 ± (0 - 0) | 0 ± (0 - 0) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 7.66 ± (7.65 - 7.66) MB | 7.67 ± (7.67 - 7.68) MB | +0.2% | ✅⬆️ |
| runtime.dotnet.threads.count | 10 ± (10 - 10) | 10 ± (10 - 10) | +0.0% | ✅ |
| .NET 8 - Bailout | ||||
| process.internal_duration_ms | 18.87 ± (18.85 - 18.89) ms | 20.59 ± (20.53 - 20.65) ms | +9.1% | ✅⬆️ |
| process.time_to_main_ms | 68.62 ± (68.56 - 68.67) ms | 79.73 ± (79.53 - 79.93) ms | +16.2% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 0 ± (0 - 0) | 0 ± (0 - 0) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 7.75 ± (7.73 - 7.76) MB | 7.72 ± (7.71 - 7.74) MB | -0.3% | ✅ |
| runtime.dotnet.threads.count | 11 ± (11 - 11) | 11 ± (11 - 11) | +0.0% | ✅ |
| .NET 8 - CallTarget+Inlining+NGEN | ||||
| process.internal_duration_ms | 178.45 ± (177.56 - 179.34) ms | 197.83 ± (197.00 - 198.66) ms | +10.9% | ✅⬆️ |
| process.time_to_main_ms | 429.97 ± (429.42 - 430.51) ms | 474.89 ± (473.88 - 475.91) ms | +10.4% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 0 ± (0 - 0) | 0 ± (0 - 0) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 36.51 ± (36.48 - 36.54) MB | 36.97 ± (36.93 - 37.02) MB | +1.3% | ✅⬆️ |
| runtime.dotnet.threads.count | 27 ± (27 - 27) | 27 ± (27 - 27) | -0.2% | ✅ |
HttpMessageHandler
| Metric | Master (Mean ± 95% CI) | Current (Mean ± 95% CI) | Change | Status |
|---|---|---|---|---|
| .NET Framework 4.8 - Baseline | ||||
| duration | 192.09 ± (192.01 - 192.81) ms | 194.14 ± (193.87 - 194.54) ms | +1.1% | ✅⬆️ |
| .NET Framework 4.8 - Bailout | ||||
| duration | 195.01 ± (194.95 - 195.49) ms | 198.71 ± (198.41 - 198.97) ms | +1.9% | ✅⬆️ |
| .NET Framework 4.8 - CallTarget+Inlining+NGEN | ||||
| duration | 1109.23 ± (1114.44 - 1123.54) ms | 1131.72 ± (1132.16 - 1139.61) ms | +2.0% | ✅⬆️ |
| .NET Core 3.1 - Baseline | ||||
| process.internal_duration_ms | 186.98 ± (186.62 - 187.34) ms | 189.88 ± (189.44 - 190.32) ms | +1.5% | ✅⬆️ |
| process.time_to_main_ms | 80.37 ± (80.14 - 80.60) ms | 81.83 ± (81.61 - 82.05) ms | +1.8% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 3 ± (3 - 3) | 3 ± (3 - 3) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 16.12 ± (16.09 - 16.15) MB | 16.03 ± (16.01 - 16.06) MB | -0.6% | ✅ |
| runtime.dotnet.threads.count | 20 ± (20 - 20) | 20 ± (19 - 20) | -0.1% | ✅ |
| .NET Core 3.1 - Bailout | ||||
| process.internal_duration_ms | 185.55 ± (185.30 - 185.81) ms | 190.20 ± (189.75 - 190.66) ms | +2.5% | ✅⬆️ |
| process.time_to_main_ms | 81.65 ± (81.50 - 81.81) ms | 83.48 ± (83.24 - 83.71) ms | +2.2% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 3 ± (3 - 3) | 3 ± (3 - 3) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 16.14 ± (16.12 - 16.17) MB | 16.11 ± (16.09 - 16.13) MB | -0.2% | ✅ |
| runtime.dotnet.threads.count | 21 ± (20 - 21) | 21 ± (20 - 21) | +0.2% | ✅⬆️ |
| .NET Core 3.1 - CallTarget+Inlining+NGEN | ||||
| process.internal_duration_ms | 432.33 ± (429.49 - 435.17) ms | 427.91 ± (424.68 - 431.14) ms | -1.0% | ✅ |
| process.time_to_main_ms | 471.32 ± (470.78 - 471.86) ms | 485.49 ± (484.31 - 486.67) ms | +3.0% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 3 ± (3 - 3) | 3 ± (3 - 3) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 58.66 ± (58.54 - 58.77) MB | 58.83 ± (58.72 - 58.95) MB | +0.3% | ✅⬆️ |
| runtime.dotnet.threads.count | 29 ± (29 - 29) | 29 ± (29 - 30) | +0.2% | ✅⬆️ |
| .NET 6 - Baseline | ||||
| process.internal_duration_ms | 191.71 ± (191.30 - 192.12) ms | 195.40 ± (194.94 - 195.86) ms | +1.9% | ✅⬆️ |
| process.time_to_main_ms | 70.10 ± (69.93 - 70.27) ms | 71.82 ± (71.60 - 72.04) ms | +2.5% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 4 ± (4 - 4) | 4 ± (4 - 4) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 16.10 ± (15.96 - 16.24) MB | 16.36 ± (16.33 - 16.39) MB | +1.6% | ✅⬆️ |
| runtime.dotnet.threads.count | 18 ± (18 - 18) | 19 ± (19 - 19) | +5.3% | ✅⬆️ |
| .NET 6 - Bailout | ||||
| process.internal_duration_ms | 190.06 ± (189.84 - 190.29) ms | 192.55 ± (192.21 - 192.89) ms | +1.3% | ✅⬆️ |
| process.time_to_main_ms | 70.63 ± (70.53 - 70.74) ms | 72.12 ± (71.97 - 72.27) ms | +2.1% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 4 ± (4 - 4) | 4 ± (4 - 4) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 15.89 ± (15.73 - 16.04) MB | 16.08 ± (15.94 - 16.22) MB | +1.2% | ✅⬆️ |
| runtime.dotnet.threads.count | 19 ± (19 - 19) | 20 ± (19 - 20) | +3.4% | ✅⬆️ |
| .NET 6 - CallTarget+Inlining+NGEN | ||||
| process.internal_duration_ms | 443.82 ± (441.03 - 446.61) ms | 446.23 ± (442.75 - 449.71) ms | +0.5% | ✅⬆️ |
| process.time_to_main_ms | 447.88 ± (447.42 - 448.35) ms | 456.41 ± (455.86 - 456.96) ms | +1.9% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 4 ± (4 - 4) | 4 ± (4 - 4) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 58.95 ± (58.84 - 59.07) MB | 58.72 ± (58.58 - 58.85) MB | -0.4% | ✅ |
| runtime.dotnet.threads.count | 29 ± (29 - 29) | 29 ± (29 - 29) | -0.1% | ✅ |
| .NET 8 - Baseline | ||||
| process.internal_duration_ms | 190.04 ± (189.63 - 190.45) ms | 191.62 ± (191.30 - 191.95) ms | +0.8% | ✅⬆️ |
| process.time_to_main_ms | 69.78 ± (69.62 - 69.94) ms | 70.57 ± (70.37 - 70.77) ms | +1.1% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 4 ± (4 - 4) | 4 ± (4 - 4) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 11.81 ± (11.78 - 11.84) MB | 11.71 ± (11.68 - 11.73) MB | -0.9% | ✅ |
| runtime.dotnet.threads.count | 18 ± (18 - 18) | 18 ± (18 - 18) | -0.0% | ✅ |
| .NET 8 - Bailout | ||||
| process.internal_duration_ms | 188.67 ± (188.39 - 188.96) ms | 193.22 ± (192.74 - 193.70) ms | +2.4% | ✅⬆️ |
| process.time_to_main_ms | 70.75 ± (70.61 - 70.90) ms | 72.15 ± (71.98 - 72.32) ms | +2.0% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 4 ± (4 - 4) | 4 ± (4 - 4) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 11.87 ± (11.83 - 11.92) MB | 11.75 ± (11.73 - 11.77) MB | -1.0% | ✅ |
| runtime.dotnet.threads.count | 19 ± (18 - 19) | 19 ± (19 - 19) | +2.9% | ✅⬆️ |
| .NET 8 - CallTarget+Inlining+NGEN | ||||
| process.internal_duration_ms | 364.01 ± (362.25 - 365.77) ms | 368.08 ± (366.82 - 369.35) ms | +1.1% | ✅⬆️ |
| process.time_to_main_ms | 434.84 ± (434.24 - 435.44) ms | 438.13 ± (437.41 - 438.85) ms | +0.8% | ✅⬆️ |
| runtime.dotnet.exceptions.count | 4 ± (4 - 4) | 4 ± (4 - 4) | +0.0% | ✅ |
| runtime.dotnet.mem.committed | 48.20 ± (48.16 - 48.24) MB | 48.22 ± (48.18 - 48.26) MB | +0.0% | ✅⬆️ |
| runtime.dotnet.threads.count | 29 ± (28 - 29) | 29 ± (29 - 29) | +1.2% | ✅⬆️ |
Comparison explanation
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 highlighted 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).
Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8079) - mean (78ms) : 75, 81
master - mean (69ms) : 67, 70
section Bailout
This PR (8079) - mean (83ms) : crit, 80, 85
master - mean (72ms) : 71, 73
section CallTarget+Inlining+NGEN
This PR (8079) - mean (1,093ms) : crit, 1028, 1159
master - mean (1,020ms) : 939, 1101
FakeDbCommand (.NET Core 3.1)
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8079) - mean (124ms) : 120, 128
master - mean (106ms) : 104, 109
section Bailout
This PR (8079) - mean (124ms) : crit, 121, 128
master - mean (107ms) : 106, 109
section CallTarget+Inlining+NGEN
This PR (8079) - mean (806ms) : crit, 748, 864
master - mean (740ms) : 687, 794
FakeDbCommand (.NET 6)
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8079) - mean (111ms) : 107, 115
master - mean (94ms) : 92, 96
section Bailout
This PR (8079) - mean (111ms) : crit, 108, 115
master - mean (95ms) : 94, 96
section CallTarget+Inlining+NGEN
This PR (8079) - mean (772ms) : crit, 696, 847
master - mean (722ms) : 691, 753
FakeDbCommand (.NET 8)
gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8079) - mean (107ms) : 103, 111
master - mean (93ms) : 90, 95
section Bailout
This PR (8079) - mean (108ms) : crit, 106, 111
master - mean (93ms) : 92, 95
section CallTarget+Inlining+NGEN
This PR (8079) - mean (712ms) : crit, 690, 733
master - mean (636ms) : 621, 650
HttpMessageHandler (.NET Framework 4.8)
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8079) - mean (194ms) : 191, 197
master - mean (192ms) : 188, 196
section Bailout
This PR (8079) - mean (199ms) : 196, 201
master - mean (195ms) : 193, 198
section CallTarget+Inlining+NGEN
This PR (8079) - mean (1,136ms) : 1083, 1189
master - mean (1,119ms) : 1052, 1186
HttpMessageHandler (.NET Core 3.1)
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8079) - mean (280ms) : 273, 287
master - mean (276ms) : 270, 282
section Bailout
This PR (8079) - mean (283ms) : 275, 290
master - mean (275ms) : 272, 278
section CallTarget+Inlining+NGEN
This PR (8079) - mean (947ms) : 895, 998
master - mean (930ms) : 880, 980
HttpMessageHandler (.NET 6)
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8079) - mean (276ms) : 269, 282
master - mean (270ms) : 265, 274
section Bailout
This PR (8079) - mean (273ms) : 269, 276
master - mean (269ms) : 266, 272
section CallTarget+Inlining+NGEN
This PR (8079) - mean (930ms) : 876, 984
master - mean (916ms) : 858, 974
HttpMessageHandler (.NET 8)
gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8079) - mean (272ms) : 266, 278
master - mean (269ms) : 262, 276
section Bailout
This PR (8079) - mean (275ms) : 266, 284
master - mean (269ms) : 264, 274
section CallTarget+Inlining+NGEN
This PR (8079) - mean (839ms) : 823, 855
master - mean (832ms) : 809, 855
ddd2357 to
a9b5436
Compare
BenchmarksBenchmark execution time: 2026-01-26 15:16:50 Comparing candidate commit 19c86a2 in PR branch Found 12 performance improvements and 8 performance regressions! Performance is the same for 155 metrics, 17 unstable metrics. scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0
scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472
scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1
scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0
|
| var functionsWorkerRuntime = EnvironmentHelpers.GetEnvironmentVariable(PlatformKeys.AzureFunctions.FunctionsWorkerRuntime); | ||
|
|
||
| if (!string.IsNullOrEmpty(functionsExtensionVersion) && !string.IsNullOrEmpty(functionsWorkerRuntime)) | ||
| if (!SkipAspNetCoreDiagnosticObserver()) |
There was a problem hiding this comment.
Previously this was looking at FUNCTIONS_EXTENSION_VERSION and FUNCTIONS_WORKER_RUNTIME, and now it is doing EnvironmentHelpers.IsAzureFunctions() which adds WEBSITE_SITE_NAME to the check. Seems totally intended, just mentioning it because the PR says there are no functional changes and I'm not sure if this has other consequences
There was a problem hiding this comment.
Good catch, thanks! I'll take a closer look.
There was a problem hiding this comment.
Ahh, yes. In EnvironmentHelpers we also check WEBSITE_SITE_NAME which we didn't do here before. It shouldn't make any difference in practice (all 3 env vars should always be set). We only check for the additional env vars to be safe, I guess.
Simplify Azure Functions logic by introducing `IsAzureFunctionsIsolated` and refactoring worker runtime checks into reusable methods.
a9b5436 to
19c86a2
Compare
## Summary of changes Refactor Azure Functions instrumentation code as a precursor to #7628. ## Reason for change The changes in #7628 were building up, so I decided to split them into two PRs. This PR is mostly cleanup and refactoring. No functional changes. ## Implementation details **Environment detection helpers** (`EnvironmentHelpers`) - Added `IsAzureFunctionsIsolated()` - detects isolated worker runtime - Added `GetAzureFunctionsWorkerRuntime()` - retrieves worker runtime value - Added `GetAzureFunctionsExtensionVersion()` - retrieves extension version - Refactored `IsRunningInAzureFunctionsHost()` to use new helpers **Diagnostic observer initialization** (`Instrumentation`) - Extracted `GetAspNetCoreDiagnosticObserver()` - Extracted `SkipAspNetCoreDiagnosticObserver()` **Azure Functions instrumentation cleanup** (`AzureFunctionsCommon`) - Renamed parameter `context` to `functionContext` for clarity and consistency - Made `CreateIsolatedFunctionScope()` private - Formatting: improved comment alignment and whitespace - Changed `if` to `switch` for trigger type handling **ASP.NET Core tracking key rename** - Renamed `HttpContextItemsKey` to `HttpContextTrackingKey` across all usages (will add another key in next PR, needed to distinguish them since they are both "item keys") ## Test coverage No new tests added - this is a refactoring/cleanup PR with no functional changes. Existing Azure Functions tests provide coverage. ## Other details Precursor to #7628 - Fix span parenting for isolated Azure Functions using ASP.NET Core integration
Summary of changes
Refactor Azure Functions instrumentation code as a precursor to #7628.
Reason for change
The changes in #7628 were building up, so I decided to split them into two PRs. This PR is mostly cleanup and refactoring. No functional changes.
Implementation details
Environment detection helpers (
EnvironmentHelpers)IsAzureFunctionsIsolated()- detects isolated worker runtimeGetAzureFunctionsWorkerRuntime()- retrieves worker runtime valueGetAzureFunctionsExtensionVersion()- retrieves extension versionIsRunningInAzureFunctionsHost()to use new helpersDiagnostic observer initialization (
Instrumentation)GetAspNetCoreDiagnosticObserver()SkipAspNetCoreDiagnosticObserver()Azure Functions instrumentation cleanup (
AzureFunctionsCommon)contexttofunctionContextfor clarity and consistencyCreateIsolatedFunctionScope()privateiftoswitchfor trigger type handlingASP.NET Core tracking key rename
HttpContextItemsKeytoHttpContextTrackingKeyacross all usages (will add another key in next PR, needed to distinguish them since they are both "item keys")Test coverage
No new tests added - this is a refactoring/cleanup PR with no functional changes. Existing Azure Functions tests provide coverage.
Other details
Precursor to #7628 - Fix span parenting for isolated Azure Functions using ASP.NET Core integration