Skip to content

Commit 1d7e0b5

Browse files
Merge pull request #227331 from AaronMaxwell/aaronmax-azure-web-apps-java-update
move step 5 above troubleshooting
2 parents bb5c101 + 27142ba commit 1d7e0b5

File tree

1 file changed

+35
-21
lines changed

1 file changed

+35
-21
lines changed

articles/azure-monitor/app/azure-web-apps-java.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
title: Monitor Azure app services performance Java | Microsoft Docs
33
description: Application performance monitoring for Azure app services using Java. Chart load and response time, dependency information, and set alerts on performance.
44
ms.topic: conceptual
5-
ms.date: 11/15/2022
5+
ms.date: 02/14/2023
66
ms.devlang: java
77
ms.custom: "devx-track-java"
88
ms.reviewer: abinetabate
99
---
1010

1111
# Application Monitoring for Azure App Service and Java
1212

13-
Monitoring of your Java web applications running on [Azure App Services](../../app-service/index.yml) does not require any modifications to the code. This article will walk you through enabling Azure Monitor Application Insights monitoring as well as provide preliminary guidance for automating the process for large-scale deployments.
13+
Monitoring of your Java web applications running on [Azure App Services](../../app-service/index.yml) doesn't require any modifications to the code. This article walks you through enabling Azure Monitor Application Insights monitoring and provides preliminary guidance for automating the process for large-scale deployments.
1414

1515
## Enable Application Insights
1616

1717
The recommended way to enable application monitoring for Java applications running on Azure App Services is through Azure portal.
1818
Turning on application monitoring in Azure portal will automatically instrument your application with Application Insights, and doesn't require any code changes.
19-
You can apply additional configurations, and then based on your specific scenario you [add your own custom telemetry](./opentelemetry-enable.md?tabs=java#modify-telemetry) if needed.
19+
You can apply extra configurations, and then based on your specific scenario you [add your own custom telemetry](./opentelemetry-enable.md?tabs=java#modify-telemetry) if needed.
2020

2121
### Auto-instrumentation through Azure portal
2222

23-
You can turn on monitoring for your Java apps running in Azure App Service just with one click, no code change required. The integration adds [Application Insights Java 3.x](./opentelemetry-enable.md?tabs=java) and you will get the telemetry auto-collected.
23+
You can turn on monitoring for your Java apps running in Azure App Service just with one selection, no code change required. The integration adds [Application Insights Java 3.x](./opentelemetry-enable.md?tabs=java) and auto-collects telemetry.
2424

2525
For a complete list of supported auto-instrumentation scenarios, see [Supported environments, languages, and resource providers](codeless-overview.md#supported-environments-languages-and-resource-providers).
2626

@@ -35,11 +35,11 @@ For a complete list of supported auto-instrumentation scenarios, see [Supported
3535
3636
:::image type="content"source="./media/azure-web-apps/change-resource.png" alt-text="Screenshot of Change your resource dropdown.":::
3737

38-
3. This last step is optional. After specifying which resource to use, you can configure the Java agent. If you do not configure the Java agent, default configurations will apply.
38+
3. This last step is optional. After specifying which resource to use, you can configure the Java agent. If you don't configure the Java agent, default configurations apply.
3939

40-
The full [set of configurations](./java-standalone-config.md) is available, you just need to paste a valid [json file](./java-standalone-config.md#an-example). **Exclude the connection string and any configurations that are in preview** - you will be able to add the items that are currently in preview as they become generally available.
40+
The full [set of configurations](./java-standalone-config.md) is available, you just need to paste a valid [json file](./java-standalone-config.md#an-example). **Exclude the connection string and any configurations that are in preview** - you're able to add the items that are currently in preview as they become generally available.
4141

42-
Once you modify the configurations through Azure portal, APPLICATIONINSIGHTS_CONFIGURATION_FILE environment variable will automatically be populated and will appear in App Service settings panel. This variable will contain the full json content that you have pasted in Azure portal configuration text box for your Java app.
42+
Once you modify the configurations through Azure portal, APPLICATIONINSIGHTS_CONFIGURATION_FILE environment variable are automatically populated and appear in App Service settings panel. This variable contains the full json content that you've pasted in Azure portal configuration text box for your Java app.
4343

4444
:::image type="content"source="./media/azure-web-apps-java/create-app-service-ai.png" alt-text="Screenshot of instrument your application.":::
4545

@@ -68,31 +68,45 @@ In order to enable telemetry collection with Application Insights, only the foll
6868

6969
## Troubleshooting
7070

71-
Below is our step-by-step troubleshooting guide for Java-based applications running on Azure App Services.
71+
Use our step-by-step guide to troubleshoot Java-based applications running on Azure App Services.
7272

7373
1. Check that `ApplicationInsightsAgent_EXTENSION_VERSION` app setting is set to a value of "~2" on Windows, "~3" on Linux
7474
1. Examine the log file to see that the agent has started successfully: browse to `https://yoursitename.scm.azurewebsites.net/, under SSH change to the root directory, the log file is located under LogFiles/ApplicationInsights.
7575

7676
:::image type="content"source="./media/azure-web-apps-java/app-insights-java-status.png" alt-text="Screenshot of the link above results page.":::
7777

78-
1. After enabling application monitoring for your Java app, you can validate that the agent is working by looking at the live metrics - even before you deploy and app to App Service you will see some requests from the environment. Remember that the full set of telemetry will only be available when you have your app deployed and running.
79-
1. Set APPLICATIONINSIGHTS_SELF_DIAGNOSTICS_LEVEL environment variable to 'debug' if you do not see any errors and there is no telemetry
80-
1. Sometimes the latest version of the Application Insights Java agent is not available in App Service - it takes a couple of months for the latest versions to roll out to all regions. In case you need the latest version of Java agent to monitor your app in App Service, you can upload the agent manually:
81-
* Upload the Java agent jar file to App Service
82-
* Get the latest version of [Azure CLI](/cli/azure/install-azure-cli-windows?tabs=azure-cli)
83-
* Get the latest version of [Application Insights Java agent](./opentelemetry-enable.md?tabs=java)
84-
* Deploy Java agent to App Service - a sample command to deploy the Java agent jar: `az webapp deploy --src-path applicationinsights-agent-{VERSION_NUMBER}.jar --target-path java/applicationinsights-agent-{VERSION_NUMBER}.jar --type static --resource-group {YOUR_RESOURCE_GROUP} --name {YOUR_APP_SVC_NAME}` or use [this guide](../../app-service/quickstart-java.md?tabs=javase&pivots=platform-linux#3---configure-the-maven-plugin) to deploy through Maven plugin
85-
* Once the agent jar file is uploaded, go to App Service configurations and add a new environment variable, JAVA_OPTS, and set its value to `-javaagent:D:/home/{PATH_TO_THE_AGENT_JAR}/applicationinsights-agent-{VERSION_NUMBER}.jar`
86-
* Disable Application Insights via Application Insights tab
87-
* Restart the app
88-
89-
> [!NOTE]
90-
> If you set the JAVA_OPTS environment variable, you will have to disable Application Insights in the portal. Alternatively, if you prefer to enable Application Insights from the portal, make sure that you don't set the JAVA_OPTS variable in App Service configurations settings.
78+
1. After enabling application monitoring for your Java app, you can validate that the agent is working by looking at the live metrics - even before you deploy and app to App Service you'll see some requests from the environment. Remember that the full set of telemetry is only available when you have your app deployed and running.
79+
1. Set APPLICATIONINSIGHTS_SELF_DIAGNOSTICS_LEVEL environment variable to 'debug' if you don't see any errors and there's no telemetry
9180

9281
[!INCLUDE [azure-web-apps-troubleshoot](../../../includes/azure-monitor-app-insights-azure-web-apps-troubleshoot.md)]
9382

9483
[!INCLUDE [azure-monitor-app-insights-test-connectivity](../../../includes/azure-monitor-app-insights-test-connectivity.md)]
9584

85+
## Manually deploy the latest Application Insights Java version
86+
87+
The Application Insights Java version is updated automatically as part of App Services updates.
88+
89+
If you encounter an issue that's fixed in the latest version of Application Insights Java, you can update it manually.
90+
91+
To manually update, follow these steps:
92+
93+
1. Upload the Java agent jar file to App Service
94+
95+
> a. First, get the latest version of Azure CLI by following the instructions [here](/cli/azure/install-azure-cli-windows?tabs=azure-cli).
96+
97+
> b. Next, get the latest version of the Application Insights Java agent by following the instructions [here](./opentelemetry-enable.md?tabs=java).
98+
99+
> c. Then, deploy the Java agent jar file to App Service using the following command: `az webapp deploy --src-path applicationinsights-agent-{VERSION_NUMBER}.jar --target-path java/applicationinsights-agent-{VERSION_NUMBER}.jar --type static --resource-group {YOUR_RESOURCE_GROUP} --name {YOUR_APP_SVC_NAME}`. Alternatively, you can use [this guide](../../app-service/quickstart-java.md?tabs=javase&pivots=platform-linux#3---configure-the-maven-plugin) to deploy the agent through the Maven plugin.
100+
101+
2. Disable Application Insights via the Application Insights tab in the Azure portal.
102+
103+
3. Once the agent jar file is uploaded, go to App Service configurations and add a new environment variable, `JAVA_OPTS`, with the value `-javaagent:{PATH_TO_THE_AGENT_JAR}/applicationinsights-agent-{VERSION_NUMBER}.jar`.
104+
105+
4. Restart the app, leaving the **Startup Command** field blank, to apply the changes.
106+
107+
> [!NOTE]
108+
> If you set the JAVA_OPTS environment variable, you will have to disable Application Insights in the portal. Alternatively, if you prefer to enable Application Insights from the portal, make sure that you don't set the `JAVA_OPTS` variable in App Service configurations settings.
109+
96110
## Release notes
97111

98112
For the latest updates and bug fixes, [consult the release notes](web-app-extension-release-notes.md).

0 commit comments

Comments
 (0)