We have been working on getting dependency tracking working on Application insights using the following documentation for a Java Application:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-get-started?tabs=maven
https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-agent
Current versions we are using are:
- Application Insights Agent and applicationinsights-web-auto in the POM.xml file - 2.6.1
- MySQL connector - 5.1.31
The following files - AI-Agents.xml, ApplicationInsights.xml and applicationinsights-agent-2.6.1.jar - were added into
/home/site/wwwroot/
All the attempts below have been made on both a Window and a Linux App Service.
Locally, in the IDE (IntelliJ) when we add all these files into the resources folder and run the application with the above files configured in the VM options, dependencies are tracked without a problem. However, replicating the same configuration on the App Service displays the exception below.
Can anyone advice on whether any configurations are missing or if further configurations are required to get auto dependency tracking working please?
Thank you
2020-08-18T11:18:54.583510165Z: [ERROR] org.apache.catalina.LifecycleException: Failed to start component [/ApplicationInsights]
2020-08-18T11:18:54.583515565Z: [ERROR] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
2020-08-18T11:18:54.583519665Z: [ERROR] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
2020-08-18T11:18:54.583523465Z: [ERROR] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
2020-08-18T11:18:54.583555865Z: [ERROR] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:744)
2020-08-18T11:18:54.583569265Z: [ERROR] at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:624)
2020-08-18T11:18:54.583573565Z: [ERROR] at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1833)
2020-08-18T11:18:54.583577365Z: [ERROR] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
2020-08-18T11:18:54.583581365Z: [ERROR] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2020-08-18T11:18:54.583585065Z: [ERROR] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2020-08-18T11:18:54.583588965Z: [ERROR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2020-08-18T11:18:54.583592665Z: [ERROR] at java.lang.Thread.run(Thread.java:748)
Content in Application Insights file:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30">
<!-- The key from the portal: -->
<InstrumentationKey>** Your instrumentation key **</InstrumentationKey>
<!-- HTTP request component (not required for bare API) -->
<TelemetryModules>
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebRequestTrackingTelemetryModule"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebSessionTrackingTelemetryModule"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebUserTrackingTelemetryModule"/>
</TelemetryModules>
<!-- Events correlation (not required for bare API) -->
<!-- These initializers add context data to each event -->
<TelemetryInitializers>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationIdTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationNameTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebSessionTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserAgentTelemetryInitializer"/>
</TelemetryInitializers>
</ApplicationInsights>
Content in AI-Agents file:
<ApplicationInsightsAgent>
<Instrumentation>
<BuiltIn enabled="true">
<!-- capture logging via Log4j 1.2, Log4j2, and Logback, default is true -->
<Logging enabled="true" />
<!-- capture outgoing HTTP calls performed through Apache HttpClient, OkHttp,
and java.net.HttpURLConnection, default is true -->
<HTTP enabled="true" W3C="true" enableW3CBackCompat="true"/>
<!-- capture JDBC queries, default is true -->
<JDBC enabled="true" />
<!-- capture Redis calls, default is true -->
<Jedis enabled="true" />
<!-- capture query plans for JDBC queries that exceed this value (MySQL, PostgreSQL),
default is 10000 milliseconds -->
<MaxStatementQueryLimitInMS>1000</MaxStatementQueryLimitInMS>
</BuiltIn>
</Instrumentation>
</ApplicationInsightsAgent>