-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Isolated Azure Functions performance when using
ASP.NET Core
In…
…tegration (#6567) ## 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. <!--⚠️ Note: where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. --> --------- Co-authored-by: Andrew Lock <[email protected]>
- Loading branch information
1 parent
3375c75
commit 7e973a6
Showing
28 changed files
with
1,680 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.