-
Notifications
You must be signed in to change notification settings - Fork 208
Description
Hello,
we use Application Insights in a Spring-Boot application. When using version 1.0.x we noticed the following log messages:
AI: ERROR 26-02-2018 13:21, 42: WebApp name is not found, unable to register WebApp
AI: INFO 26-02-2018 13:21, 42: Successfully registered the filter 'ApplicationInsightsWebFilter'
With version 2.0.0-BETA it is now possible to explicitly set the application name in the constructor of the WebRequestTrackingFilter class. However, this leads to the following logs:
AI: INFO 26-02-2018 13:25, 43: Registering WebApp with name 'general-payment'
AI: ERROR 26-02-2018 13:25, 43: Could not find Agent: 'com/microsoft/applicationinsights/agent/internal/coresync/AgentNotificationsHandler'
AI: ERROR 26-02-2018 13:25, 43: Failed to register 'ApplicationInsightsWebFilter', exception: 'com/microsoft/applicationinsights/internal/agent/CoreAgentNotificationsHandler'
So it seems that AI 2.0.0 additionally requires the Java Agent to be configured. Configuring the Java Agent seems to satisfy AI (no more error logs):
AI: INFO 26-02-2018 13:27, 43: Registering WebApp with name 'general-payment'
AI: INFO 26-02-2018 13:27, 43: Registered WebApp 'general-payment' key='general-payment'
AI: INFO 26-02-2018 13:27, 43: Successfully registered the filter 'ApplicationInsightsWebFilter'
However, our application asynchrounously calls a REST API on remote services in a scheduler. Whenever such an asynchronous HTTP request is issued, the following NullpointerException occurrs:
java.lang.NullPointerException: null
at com.microsoft.applicationinsights.web.internal.correlation.TelemetryCorrelationUtils.retrieveCorrelationContext(TelemetryCorrelationUtils.java:140)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
This NPE occurrs as there is no correlation context set by the WebRequestTrackingFilter, because the request was issued by a scheduler (and is not the result of an HTTP request received by our application).
The NPE basically prevents our application from working.
So I see two issues here:
- AI should not make it mandatory to use the Java agent (not sure if this is possible)
- The Java Agent should never throw Exceptions that basically stop the application from working
Does this sound reasonable?
Thanks,
Jürgen
=> AI should never throw exceptions that influence the business application.
Thanks.