Skip to content

Files

Latest commit

 

History

History
153 lines (103 loc) · 7.93 KB

app-insights-java-troubleshoot.md

File metadata and controls

153 lines (103 loc) · 7.93 KB
title description services documentationcenter author manager ms.assetid ms.service ms.workload ms.tgt_pltfrm ms.devlang ms.topic ms.date ms.author
Troubleshoot Application Insights in a Java web project
Troubleshooting guide - monitoring live Java apps with Application Insights.
application-insights
java
mrbullwinkle
carmonm
ef602767-18f2-44d2-b7ef-42b404edd0e9
application-insights
tbd
ibiza
na
article
11/16/2016
mbullwin

Troubleshooting and Q and A for Application Insights for Java

Questions or problems with Azure Application Insights in Java? Here are some tips.

Build errors

In Eclipse, when adding the Application Insights SDK via Maven or Gradle, I get build or checksum validation errors.

  • If the dependency element is using a pattern with wildcard characters (e.g. (Maven) <version>[1.0,)</version> or (Gradle) version:'1.0.+'), try specifying a specific version instead like 1.0.2. See the release notes for the latest version.

No data

I added Application Insights successfully and ran my app, but I've never seen data in the portal.

  • Wait a minute and click Refresh. The charts refresh themselves periodically, but you can also refresh manually. The refresh interval depends on the time range of the chart.
  • Check that you have an instrumentation key defined in the ApplicationInsights.xml file (in the resources folder in your project)
  • Verify that there is no <DisableTelemetry>true</DisableTelemetry> node in the xml file.
  • In your firewall, you might have to open TCP ports 80 and 443 for outgoing traffic to dc.services.visualstudio.com. See the full list of firewall exceptions
  • In the Microsoft Azure start board, look at the service status map. If there are some alert indications, wait until they have returned to OK and then close and re-open your Application Insights application blade.
  • Turn on logging to the IDE console window, by adding an <SDKLogger /> element under the root node in the ApplicationInsights.xml file (in the resources folder in your project), and check for entries prefaced with [Error].
  • Make sure that the correct ApplicationInsights.xml file has been successfully loaded by the Java SDK, by looking at the console's output messages for a "Configuration file has been successfully found" statement.
  • If the config file is not found, check the output messages to see where the config file is being searched for, and make sure that the ApplicationInsights.xml is located in one of those search locations. As a rule of thumb, you can place the config file near the Application Insights SDK JARs. For example: in Tomcat, this would mean the WEB-INF/lib folder.

I used to see data, but it has stopped

  • Check the status blog.
  • Have you hit your monthly quota of data points? Open Settings/Quota and Pricing to find out. If so, you can upgrade your plan, or pay for additional capacity. See the pricing scheme.

I don't see all the data I'm expecting

  • Open the Quotas and Pricing blade and check whether sampling is in operation. (100% transmission means that sampling isn't in operation.) The Application Insights service can be set to accept only a fraction of the telemetry that arrives from your app. This helps you keep within your monthly quota of telemetry.

No usage data

I see data about requests and response times, but no page view, browser, or user data.

You successfully set up your app to send telemetry from the server. Now your next step is to set up your web pages to send telemetry from the web browser.

Alternatively, if your client is an app in a phone or other device, you can send telemetry from there.

Use the same instrumentation key to set up both your client and server telemetry. The data will appear in the same Application Insights resource, and you'll be able to correlate events from client and server.

Disabling telemetry

How can I disable telemetry collection?

In code:

    TelemetryConfiguration config = TelemetryConfiguration.getActive();
    config.setTrackingIsDisabled(true);

Or

Update ApplicationInsights.xml (in the resources folder in your project). Add the following under the root node:

    <DisableTelemetry>true</DisableTelemetry>

Using the XML method, you have to restart the application when you change the value.

Changing the target

How can I change which Azure resource my project sends data to?

  • Get the instrumentation key of the new resource.
  • If you added Application Insights to your project using the Azure Toolkit for Eclipse, right click your web project, select Azure, Configure Application Insights, and change the key.
  • Otherwise, update the key in ApplicationInsights.xml in the resources folder in your project.

Debug data from the SDK

How can I find out what the SDK is doing?

To get more information about what's happening in the API, add <SDKLogger/> under the root node of the ApplicationInsights.xml configuration file.

You can also instruct the logger to output to a file:

    <SDKLogger type="FILE">
      <enabled>True</enabled>
      <UniquePrefix>JavaSDKLog</UniquePrefix>
    </SDKLogger>

The files can be found under %temp%\javasdklogs or java.io.tmpdir in case of Tomcat server.

The Azure start screen

I'm looking at the Azure portal. Does the map tell me something about my app?

No, it shows the health of Azure servers around the world.

From the Azure start board (home screen), how do I find data about my app?

Assuming you set up your app for Application Insights, click Browse, select Application Insights, and select the app resource you created for your app. To get there faster in future, you can pin your app to the start board.

Intranet servers

Can I monitor a server on my intranet?

Yes, provided your server can send telemetry to the Application Insights portal through the public internet.

In your firewall, you might have to open TCP ports 80 and 443 for outgoing traffic to dc.services.visualstudio.com and f5.services.visualstudio.com.

Data retention

How long is data retained in the portal? Is it secure?

See Data retention and privacy.

Debug logging

Application Insights uses org.apache.http. This is relocated within Application Insights core jars under the namespace com.microsoft.applicationinsights.core.dependencies.http. This enables Application Insights to handle scenarios where different versions of the same org.apache.http exist in one code base.

Note

If you enable DEBUG level logging for all namespaces in the app, it will be honored by all executing modules including org.apache.http renamed as com.microsoft.applicationinsights.core.dependencies.http. Application Insights will not be able to apply filtering for these calls because the log call is being made by the Apache library. DEBUG level logging produce a considerable amount of log data and is not recommended for live production instances.

Next steps

I set up Application Insights for my Java server app. What else can I do?

Get help