0

It seems according to the documentation that RestTemplate and JDBC calls made within my Spring Boot application should 'automatically' be tracked with Application Insights configured. I can see my logs in AI but not the expected dependencies.

I followed the steps for the azure-application-insights-spring-boot-starter.

In the 'Migration from XML based configuration' section it directs you follow the official documentation, but that then only mentions using XML configurations.

That is also where it mentions RestTemplate and JDBC calls should be automatically tracked 'without any code changes', but I'm not seeing it.

Running on Windows App Service.

<dependency>
  <groupId>com.microsoft.azure</groupId>
  <artifactId>applicationinsights-spring-boot-starter</artifactId>
  <version>1.1.1</version>
</dependency>
<dependency>
  <groupId>com.microsoft.azure</groupId>
  <artifactId>applicationinsights-logging-logback</artifactId>
  <version>[2.0,)</version>
</dependency>

azure:
  application-insights:
    enabled: true
    instrumentation-key: <mykey>
    web:
      enabled: true
      w3c: true
    logger:
      type: console
      level: info
    default-modules:
      ProcessPerformanceCountersModule:
        enabled: true
      JvmPerformanceCountersModule:
        enabled: true
      WebRequestTrackingTelemetryModule:
        enabled: true
      WebSessionTrackingTelemetryModule:
        enabled: true
      WebUserTrackingTelemetryModule:
        enabled: true
      WebPerformanceCounterModule:
        enabled: true
      WebOperationIdTelemetryInitializer:
        enabled: true
      WebOperationNameTelemetryInitializer:
        enabled: true
      WebSessionTelemetryInitializer:
        enabled: true
      WebUserTelemetryInitializer:
        enabled: true
      WebUserAgentTelemetryInitializer:
        enabled: true

Not sure if it's relevant, but I'm running it locally and connecting to my app insights instance to check the logging. I see the following during startup:

AI: INFO 16-01-2019 14:28:38.268+0000, 18(localhost-startStop-1): Specified class com.microsoft.applicationinsights.agent.internal.coresync.AgentNotificationsHandler is not present on the classpath AI: INFO 16-01-2019 14:28:38.268+0000, 18(localhost-startStop-1): Agent was not found. Skipping the agent registration in 0.412ms

jrobkc
  • 117
  • 1
  • 14

1 Answers1

2

This is not an error but just indication that basically you also need to use ApplicationInsightsJava Agent to collect the dependencies. The relevant docs to add agent is https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-agent. I have also answered this question on the Github issue you created here. https://github.com/Microsoft/ApplicationInsights-Java/issues/566#issuecomment-454973299

Dhaval Doshi
  • 129
  • 6
  • Thank you Dhaval. I have not marked this exact question as complete because I am still having issues deploying the Agent to my Windows App Service. When I add either [JAVA_OPTS](https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-agent#install-the-application-insights-agent-for-java) or [CATALINA_OPTS](https://stackoverflow.com/questions/14731174/how-to-set-java-opts-for-tomcat-in-windows) the java process on my App Service fails to start. – jrobkc Jan 17 '19 at 23:12
  • After some trial and error, the CATALINA_OPTS with -javaagent:"D:\locationofagentjar" worked on my windows app service running Tomcat 8.5 – jrobkc Jan 18 '19 at 17:04