This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.
As the official tool for monitoring Azure App Services, App Insights is increasingly popular among App Services users. This article explores how App Insights codeless agent integrates with App Services.
To start with, here is an overview of current runtime support of App Insights codeless integration on App Services.
|
|
Codeless agent managed by platform |
Code-based App Insights SDK |
Windows |
.NET Framework |
Y |
Y |
|
.NET Core |
Y |
Y |
|
.NET |
Y |
Y |
|
Nodejs |
Y |
Y |
|
Java |
Y |
Y |
Linux |
.NET Core |
N |
Y |
|
.NET |
Y (.NET 6+) |
Y |
|
Nodejs |
Y |
Y |
|
Java |
Y |
Y |
|
Python |
N |
Y |
Next, we will look into a specific case of App Insights codeless integration with Windows .NET Framework web app to understand how it works under the covers.
1. When enabling codeless App Insights agent on the Azure Portal, XDT Transform will be performed and a preinstalled site extension is loaded from path “%SystemDrive%\Program Files (x86)\SiteExtensions\ApplicationInsightsAgent\x.x.xx”
2. XDT Transform inserts Microsoft.AppInsights.IIS.ManagedHttpModuleHelper module from GAC for target site.
3. ManagedHttpModuleHelper module implements IHttpModule, an interface offered by ASP.NET to intercept site requests. In this case, App Insights dlls are injected into application process to monitor both inbound and outbound requests.
To summarize, App Insights codeless integration with other runtime stacks on Windows web apps use similar XDT transform technology while Docker commands are employed on Linux equivalents to make things happen as Linux web apps run in container environment.
current design:
|
|
Codeless Integration |
Windows
|
.NET Framework |
XDT Transform, injecting the dll which implements IHttpModule |
|
.NET Core |
XDT Transform, the dll is injected to the .NET Core runtime by defining “ASPNETCORE_HOSTINGSTARTUPASSEMBLIES” env var |
|
.NET |
XDT Transform, similar as .NET Core |
|
Nodejs |
XDT Transform, injecting App Inisghts Nodejs agent by adding global env var “NODE_OPTIONS = --require %XDT_EXTENSIONPATH%\nodejs\build\src\Loader.js” |
|
Java |
XDT Transform, injecting App Insights Java agent by adding global env var “JAVA_OPTIONS = -javaagent:'%XDT_EXTENSIONPATH%\java\applicationinsights-agent-3.2.0.jar” |
Linux
|
.NET Core |
N/A |
|
.NET (6+) |
Similar as Windows .NET Core except that “ASPNETCORE_HOSTINGSTARTUPASSEMBLIES” env var is defined in Dockerfile |
|
Nodejs |
Similar as Windows Nodejs except that env var “NODE_OPTIONS” is added via docker run –e command |
|
Java |
Similar as Windows Java except that env var “JAVA_TOOL_OPTIONS” is added via docker run –e command |
|
Python |
N/A |
Have fun discovering!