Commit 7e973a6
Fix Isolated Azure Functions performance when using
## Summary of changes
This fixes an application performance issue when using Isolated Azure
Functions with the `ASP.NET Core` Integration caused by us modifying a
`static` `TypedData` object when requests were being proxied via HTTP.
https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=hostbuilder%2Cwindows#aspnet-core-integration
## Reason for change
When using the `ASP.NET Core` integration with an Isolated Azure
Functions application (`ConfigureFunctionsWebApplication`) under load
the worker `ASP.NET Core` application would start to timeout on requests
or hang waiting for responses from the function application.
Ultimately it appears that within `GrpcMessageConversionExtensions` a
`static` instance of the `TypedData` that we used for injection was
added specifically when the requests were being proxied via HTTP
requests. Under load we'd end up modifying this shared object with our
propagated headers which would ultimately cause requests to start timing
out as we shouldn't have been modifying those headers.
## Implementation details
We now check for when the requests are being proxied and if so we
generate a new, non-`static` `TypedData` instance that we can safely
inject headers into.
Additionally, injection into these will now correctly adhere to whether
or not the Functions automatic instrumentation is enabled or not.
I was able to reliably reproduce the issue prior to the fix and haven't
seen the issue post-fix.
## Test coverage
- Added new Azure Functions Sample projects (and tests):
- `Samples.AzureFunctions.V4Isolated.AspNetCore.SdkV1` tests `ASP.NET
Core` integration with V1 of the NuGets
- `Samples.AzureFunctions.V4Isolated.AspNetCore.Sdk` tests `ASP.NET
Core` integration with V2 of the NuGets
- Dependabot is now enabled for these sample projects as Azure Functions
fell outside of our automated version range testing
- Load tested each version of the Azure Functions model locally both pre
and post fix to validate that the fix worked.
- Manually tested and checked traces / spans emitted from both `ASP.NET
Core` and `gRPC` Function models.
## Other details
<!-- Fixes #{issue} -->
Fixes #6494
Noted some potential improvements in the signal-to-noise ratio of the
traces / spans produced by the Functions integration that we'll bring up
as future improvements.
<!-- ASP.NET Core Integration (#6567)1 parent 3375c75 commit 7e973a6
File tree
28 files changed
+1680
-75
lines changed- tracer
- src/Datadog.Trace/ClrProfiler/AutoInstrumentation/Azure/Functions
- Isolated
- test
- Datadog.Trace.ClrProfiler.IntegrationTests
- snapshots
- test-applications
- azure-functions
- Samples.AzureFunctions.V4Isolated.AspNetCore.SdkV1
- Properties
- Samples.AzureFunctions.V4Isolated.AspNetCore
- Properties
- Samples.AzureFunctions.V4Isolated.SdkV1
- Samples.AzureFunctions.V4Isolated
28 files changed
+1680
-75
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | 132 | | |
149 | 133 | | |
150 | 134 | | |
| |||
445 | 429 | | |
446 | 430 | | |
447 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
448 | 436 | | |
449 | 437 | | |
450 | 438 | | |
| |||
1043 | 1031 | | |
1044 | 1032 | | |
1045 | 1033 | | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
1046 | 1042 | | |
1047 | 1043 | | |
1048 | 1044 | | |
| |||
1063 | 1059 | | |
1064 | 1060 | | |
1065 | 1061 | | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
1069 | 1062 | | |
1070 | 1063 | | |
1071 | 1064 | | |
| |||
1215 | 1208 | | |
1216 | 1209 | | |
1217 | 1210 | | |
1218 | | - | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
1219 | 1214 | | |
1220 | 1215 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
596 | 597 | | |
597 | 598 | | |
598 | 599 | | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
| 600 | + | |
604 | 601 | | |
605 | | - | |
| 602 | + | |
606 | 603 | | |
607 | | - | |
| 604 | + | |
608 | 605 | | |
609 | 606 | | |
610 | 607 | | |
| |||
1442 | 1439 | | |
1443 | 1440 | | |
1444 | 1441 | | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
1445 | 1450 | | |
1446 | 1451 | | |
1447 | 1452 | | |
| |||
1674 | 1679 | | |
1675 | 1680 | | |
1676 | 1681 | | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
1680 | | - | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
1681 | 1685 | | |
1682 | 1686 | | |
1683 | 1687 | | |
| |||
1692 | 1696 | | |
1693 | 1697 | | |
1694 | 1698 | | |
| 1699 | + | |
1695 | 1700 | | |
| 1701 | + | |
1696 | 1702 | | |
1697 | 1703 | | |
1698 | 1704 | | |
| |||
1733 | 1739 | | |
1734 | 1740 | | |
1735 | 1741 | | |
| 1742 | + | |
1736 | 1743 | | |
1737 | 1744 | | |
1738 | 1745 | | |
| |||
Lines changed: 0 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | 283 | | |
304 | 284 | | |
305 | 285 | | |
| |||
Lines changed: 54 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
35 | 36 | | |
36 | | - | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | | - | |
44 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
45 | 92 | | |
46 | 93 | | |
47 | 94 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | | - | |
18 | | - | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
| 22 | + | |
22 | 23 | | |
23 | | - | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | | - | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | | - | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
0 commit comments