Skip to content

Commit a15d71a

Browse files
Merge pull request #10078 from kainawroth/kainawroth-java
AB#8080: Moving Java sampling troubleshooting steps to troubleshooting repo
2 parents a3fd45b + 2068639 commit a15d71a

File tree

1 file changed

+52
-45
lines changed

1 file changed

+52
-45
lines changed

support/azure/azure-monitor/app-insights/telemetry/java-standalone-troubleshoot.md

Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ This article provides troubleshooting information to resolve common issues that
1818

1919
## Check the self-diagnostic log file
2020

21-
By default, Application Insights Java 3._x_ produces a log file that's named *applicationinsights.log* in the same directory
21+
By default, Application Insights Java 3.*x* produces a log file that's named *applicationinsights.log* in the same directory
2222
that holds the *applicationinsights-agent-3.2.11.jar* file.
2323

2424
This log file is the first place to check for hints about any issues that you might be experiencing.
2525

2626
If Application Insights doesn't generate a log file, check to make sure that your Java application has the Write permission to the directory that holds the
2727
*applicationinsights-agent-3.2.11.jar* file.
2828

29-
If Application Insights still doesn't generate a log file, check the `stdout` log from your Java application for errors. Application Insights Java 3._x_
29+
If Application Insights still doesn't generate a log file, check the `stdout` log from your Java application for errors. Application Insights Java 3.*x*
3030
should log any errors that would prevent it from logging to its usual location in the `stdout` log.
3131

3232
## Troubleshoot connectivity issues
@@ -35,56 +35,56 @@ Application Insights SDKs and agents send telemetry to be ingested as REST calls
3535

3636
If the Application Insights Java agent causes the connectivity issue, consider the following options:
3737

38-
- [Verify the connection string for the Application Insights configuration](/azure/azure-monitor/app/java-standalone-config#connection-string).
38+
* [Verify the connection string for the Application Insights configuration](/azure/azure-monitor/app/java-standalone-config#connection-string).
3939

40-
- Use Application Insights Java version 3.4.6 or a later version to verify that the Java keystore contains a required certificate. To do this, [enable the self-diagnostics feature](/azure/azure-monitor/app/java-standalone-config#self-diagnostics) at the `TRACE` level. In the Application Insights logs, do you see the following entry?
40+
* Use Application Insights Java version 3.4.6 or a later version to verify that the Java keystore contains a required certificate. To do this, [enable the self-diagnostics feature](/azure/azure-monitor/app/java-standalone-config#self-diagnostics) at the `TRACE` level. In the Application Insights logs, do you see the following entry?
4141

42-
> TRACE c.m.applicationinsights.agent - Application Insights root certificate in the Java keystore: false
42+
> TRACE c.m.applicationinsights.agent - Application Insights root certificate in the Java keystore: false
4343
44-
If you see this entry, refer to [Import SSL certificates](#import-ssl-certificates) to import a root certificate in the Java keystore.
44+
If you see this entry, refer to [Import SSL certificates](#import-ssl-certificates) to import a root certificate in the Java keystore.
4545

46-
- If you use the `-Djsse.enableSNIExtension=false` option, try to run the agent without that option. From Application Insights Java version 3.4.5, if you specify `-Djsse.enableSNIExtension=false`, the following error entry appears in the logs:
46+
* If you use the `-Djsse.enableSNIExtension=false` option, try to run the agent without that option. From Application Insights Java version 3.4.5, if you specify `-Djsse.enableSNIExtension=false`, the following error entry appears in the logs:
4747

48-
> WARN c.m.applicationinsights.agent - System property -Djsse.enableSNIExtension=false is detected. If you have connection issues with Application Insights, please remove this.
48+
> WARN c.m.applicationinsights.agent - System property -Djsse.enableSNIExtension=false is detected. If you have connection issues with Application Insights, please remove this.
4949
50-
- If none of the previous options are helpful, you can use [troubleshooting tools](https://github.com/microsoft/ApplicationInsights-Java/wiki/Diagnose-connection-to-the-Application-Insights-backend-(3.x)#additional-tests).
50+
* If none of the previous options are helpful, you can use [troubleshooting tools](https://github.com/microsoft/ApplicationInsights-Java/wiki/Diagnose-connection-to-the-Application-Insights-backend-(3.x)#additional-tests).
5151

5252
## Java virtual machine (JVM) fails to start
5353

5454
If the Java virtual machine (JVM) doesn't start, it might return an "Error opening zip file or JAR manifest missing" message. To troubleshoot this problem, see the following table.
5555

5656
| Problem | Action |
57-
|--|--|
57+
|---------|--------|
5858
| The Java archive (JAR) file for the agent isn't found. | Make sure that you specify a valid agent JAR path in the `-javaagent` JVM argument. |
5959
| The agent JAR file might have been corrupted during file transfer. | Try to download the agent JAR file again. |
6060

6161
## Tomcat Java apps take several minutes to start
6262

6363
If you [enabled Application Insights to monitor your Tomcat application](/azure/azure-monitor/app/java-standalone-arguments#tomcat-8-linux), there might be a several-minute delay in the time that it takes to start the application. This delay is caused because Tomcat tries to scan the Application Insights JAR files during application startup. To speed up the application start time, you can exclude the Application Insights JAR files from the list of scanned files. Scanning these JAR files isn't necessary.
6464

65-
## Upgrade from the Application Insights Java 2._x_ SDK
65+
## Upgrade from the Application Insights Java 2.*x* SDK
6666

67-
If you're already using the Application Insights Java 2._x_ SDK in your application, you can keep using it. The Application Insights Java 3._x_ agent detects, captures, and correlates any custom telemetry that you send through the 2._x_ SDK. It also prevents duplicate telemetry by suppressing any auto-collection that the 2._x_ SDK does. For more information, see [Upgrade from the Java 2._x_ SDK](/azure/azure-monitor/app/java-standalone-upgrade-from-2x).
67+
If you're already using the Application Insights Java 2.*x* SDK in your application, you can keep using it. The Application Insights Java 3.*x* agent detects, captures, and correlates any custom telemetry that you send through the 2.*x* SDK. It also prevents duplicate telemetry by suppressing any auto-collection that the 2.*x* SDK does. For more information, see [Upgrade from the Java 2.*x* SDK](/azure/azure-monitor/app/java-standalone-upgrade-from-2x).
6868

6969
## Upgrade from Application Insights Java 3.0 preview
7070

7171
If you're upgrading from the Java 3.0 Preview agent, review all the [configuration options](/azure/azure-monitor/app/java-standalone-config) carefully. The JSON structure is changed in the 3.0 general availability (GA) release.
7272

7373
These changes include:
7474

75-
- The configuration file name changed from *ApplicationInsights.json* to *applicationinsights.json*.
75+
* The configuration file name changed from *ApplicationInsights.json* to *applicationinsights.json*.
7676

77-
- The `instrumentationSettings` node is no longer present. All content in `instrumentationSettings` is moved to the root level.
77+
* The `instrumentationSettings` node is no longer present. All content in `instrumentationSettings` is moved to the root level.
7878

79-
- Configuration nodes such as `sampling`, `jmxMetrics`, `instrumentation`, and `heartbeat` are moved out of `preview` to the root level.
79+
* Configuration nodes such as `sampling`, `jmxMetrics`, `instrumentation`, and `heartbeat` are moved out of `preview` to the root level.
8080

8181
## Some logging isn't auto-collected
8282

8383
Logging is captured only if it meets the following criteria:
8484

85-
- It meets the level that's configured for the logging framework.
85+
* It meets the level that's configured for the logging framework.
8686

87-
- It meets the level that's configured for Application Insights.
87+
* It meets the level that's configured for Application Insights.
8888

8989
For example, if your logging framework is configured to log `WARN` (and above) from the `com.example` package, and Application Insights is configured to capture `INFO` (and above), then Application Insights only captures `WARN` (and above) from the `com.example` package.
9090

@@ -107,8 +107,8 @@ This section helps you to troubleshoot and possibly fix the exceptions that are
107107

108108
There are two different paths for resolving this issue:
109109

110-
- If you're using a default Java keystore
111-
- If you're using a custom Java keystore
110+
* If you're using a default Java keystore
111+
* If you're using a custom Java keystore
112112

113113
If you aren't sure which path to follow, check to see whether you have the JVM argument, `-Djavax.net.ssl.trustStore=...`.
114114
If you don't have this JVM argument, then you're probably using the default Java keystore.
@@ -124,14 +124,14 @@ The default Java keystore typically already has all the CA root certificates. Ho
124124
You can redirect the output to a temporary file so that it's easy to search on later:
125125
> `keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts > temp.txt`
126126
127-
2. After you have the list of certificates, follow the [steps to download the SSL certificate](#steps-to-download-the-ssl-certificate) that was used to sign the Application Insights endpoint.
127+
1. After you have the list of certificates, follow the [steps to download the SSL certificate](#steps-to-download-the-ssl-certificate) that was used to sign the Application Insights endpoint.
128128

129129
After you download the certificate, generate an SHA-1 hash on the certificate by using the following command:
130130
> `keytool -printcert -v -file "<downloaded-ssl-certificate>.cer"`
131131
132132
Copy the SHA-1 value, and check whether this value is present in the *temp.txt* file that you saved previously. If you can't find the SHA-1 value in the temporary file, then the downloaded SSL certificate is missing in the default Java keystore.
133133

134-
3. Import the SSL certificate to the default Java keystore by using the following command:
134+
1. Import the SSL certificate to the default Java keystore by using the following command:
135135
> `keytool -import -file "<certificate-file>" -alias "<some-meaningful-name>" -keystore "<path-to-cacerts-file>"`
136136
137137
In this example, the command reads as follows:
@@ -145,34 +145,35 @@ We recommend the following two steps to resolve this issue:
145145

146146
1. Follow [these steps to download the SSL certificate](#steps-to-download-the-ssl-certificate) from the Application Insights endpoint.
147147

148-
2. Run the following command to import the SSL certificate to the custom Java keystore:
148+
1. Run the following command to import the SSL certificate to the custom Java keystore:
149+
149150
> `keytool -importcert -alias <your-ssl-certificate> -file "<your-downloaded-ssl-certificate-name>.cer" -keystore "<your-keystore-name>" -storepass "<your-keystore-password>" -noprompt`
150151
151152
### Steps to download the SSL certificate
152153

153154
> [!NOTE]
154155
> The following SSL certificate download instructions were validated on the following browsers:
155156
>
156-
> - Google Chrome
157-
> - Microsoft Edge
157+
> * Google Chrome
158+
> * Microsoft Edge
158159
159160
1. Open the <https://westeurope-5.in.applicationinsights.azure.com/api/ping> URL address in a web browser.
160161

161-
2. In the browser's address bar, select the **View site information** icon (a lock symbol that's next to the address).
162+
1. In the browser's address bar, select the **View site information** icon (a lock symbol that's next to the address).
162163

163-
3. Select **Connection is secure**.
164+
1. Select **Connection is secure**.
164165

165-
4. Select the **Show certificate** icon.
166+
1. Select the **Show certificate** icon.
166167

167-
5. In the **Certificate Viewer** dialog box, select the **Details** tab.
168+
1. In the **Certificate Viewer** dialog box, select the **Details** tab.
168169

169-
6. In the **Certificate Hierarchy** list, select the certificate that you want to download. (The CA root certificate, the intermediate certificate, and the leaf SSL certificate are shown.)
170+
1. In the **Certificate Hierarchy** list, select the certificate that you want to download. (The CA root certificate, the intermediate certificate, and the leaf SSL certificate are shown.)
170171

171-
7. Select the **Export** button.
172+
1. Select the **Export** button.
172173

173-
8. In the **Save As** dialog box, browse to the directory to which you want to save the certificate (.crt) file, and then select **Save**.
174+
1. In the **Save As** dialog box, browse to the directory to which you want to save the certificate (.crt) file, and then select **Save**.
174175

175-
9. To exit the **Certificate Viewer** dialog box, select the **Close** (X) button.
176+
1. To exit the **Certificate Viewer** dialog box, select the **Close** (X) button.
176177

177178
> [!WARNING]
178179
> You'll have to repeat these steps to get the new certificate before the current certificate expires. You can find the expiration information on the **Details** tab of the **Certificate Viewer** dialog box.
@@ -216,10 +217,10 @@ public class Ciphers {
216217

217218
The Application Insights endpoints support the following cipher suites:
218219

219-
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
220-
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
221-
- TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
222-
- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
220+
* TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
221+
* TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
222+
* TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
223+
* TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
223224

224225
#### How to determine server side cipher suites
225226

@@ -231,29 +232,28 @@ If you're using Java 9 or a later version, check to make sure that the JVM inclu
231232

232233
Otherwise, these cipher suites should already be part of modern Java 8+ distributions. We recommend that you check the source of your installed Java distribution to investigate why the security providers in that Java distribution's *java.security* configuration file differ from standard Java distributions.
233234

234-
## Slow startup time in Application Insights
235+
## Slow startup time in Application Insights
235236

236237
### Java 8
237238

238239
Java 8 has a known issue that's related to the JAR file signature verification of Java agents. This issue can increase the startup time in Application Insights. To fix this issue, you can apply one of the following options:
239240

240-
- If your application is based on Spring Boot, [programmatically attach the Application Insights Java agent to the JVM](/azure/azure-monitor/app/java-spring-boot#enabling-programmatically).
241+
* If your application is based on Spring Boot, [programmatically attach the Application Insights Java agent to the JVM](/azure/azure-monitor/app/java-spring-boot#enabling-programmatically).
241242

242-
- Use Java version 11 or a later version.
243+
* Use Java version 11 or a later version.
243244

244245
### Java higher than version 8
245246

246247
To fix this issue with the Application Insights Java agent, try one of the following methods:
247248

248-
- Use an Azure configuration with more CPU power.
249-
- Disable some instrumentations described in [Suppress specific autocollected telemetry](/azure/azure-monitor/app/java-standalone-config#suppress-specific-autocollected-telemetry).
250-
- Try this experimental feature: [Startup time improvement for a limited number of CPU cores](https://github.com/microsoft/ApplicationInsights-Java/wiki/Start-up-time-improvement-with-a-limited-number-of-CPU-cores-(experimental)). If you experience any issues while using this feature, send us a feedback.
249+
* Use an Azure configuration with more CPU power.
250+
* Disable some instrumentations described in [Suppress specific autocollected telemetry](/azure/azure-monitor/app/java-standalone-config#suppress-specific-autocollected-telemetry).
251+
* Try this experimental feature: [Startup time improvement for a limited number of CPU cores](https://github.com/microsoft/ApplicationInsights-Java/wiki/Start-up-time-improvement-with-a-limited-number-of-CPU-cores-(experimental)). If you experience any issues while using this feature, send us a feedback.
251252

252253
You can also try the [monitoring solutions for Java native](/azure/azure-monitor/app/opentelemetry-enable?tabs=java-native) also applicable to a JVM-based application:
253254

254-
- With Spring Boot, the Microsoft distribution of the OpenTelemetry starter.
255-
- With Quarkus, the Quarkus Opentelemetry Exporter for Microsoft Azure.
256-
255+
* With Spring Boot, the Microsoft distribution of the OpenTelemetry starter.
256+
* With Quarkus, the Quarkus Opentelemetry Exporter for Microsoft Azure.
257257

258258
## Understand duplicated operation IDs
259259

@@ -273,6 +273,7 @@ Application logic can result in an operation ID being reused by multiple telemet
273273
}
274274
}
275275
```
276+
276277
* Enable [self-diagnostics](/azure/azure-monitor/app/java-standalone-config#self-diagnostics) at the DEBUG level and restart the application.
277278

278279
In the following log example, the operation ID comes from an incoming request, not Application Insights:
@@ -281,6 +282,12 @@ Application logic can result in an operation ID being reused by multiple telemet
281282
{"ver":1,"name":"Request",...,"ai.operation.id":"4e757357805f4eb18705abd24326b550)","ai.operation.parentId":"973487efc3db7d03"},"data":{"baseType":"RequestData","baseData":{...,"properties":{"http.request.header.traceparent":"00-4e757357805f4eb18705abd24326b550-973487efc3db7d03-01", ...}}}}
282283
```
283284

285+
## Regex issues in Java sampling overrides
286+
287+
If you use `regexp` and the sampling override doesn't work, try with the `.*` regex. If the sampling now works, it means you have an issue with the first regex and read [this regex documentation](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html).
288+
289+
If it doesn't work with `.*`, you might have a syntax issue in your `application-insights.json file`. Look at the Application Insights logs and see if you notice warning messages.
290+
284291
[!INCLUDE [Third-party disclaimer](../../../../includes/third-party-disclaimer.md)]
285292

286293
[!INCLUDE [Azure Help Support](../../../../includes/azure-help-support.md)]

0 commit comments

Comments
 (0)