You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/app/azure-web-apps-java.md
+35-21Lines changed: 35 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,25 @@
2
2
title: Monitor Azure app services performance Java | Microsoft Docs
3
3
description: Application performance monitoring for Azure app services using Java. Chart load and response time, dependency information, and set alerts on performance.
4
4
ms.topic: conceptual
5
-
ms.date: 11/15/2022
5
+
ms.date: 02/14/2023
6
6
ms.devlang: java
7
7
ms.custom: "devx-track-java"
8
8
ms.reviewer: abinetabate
9
9
---
10
10
11
11
# Application Monitoring for Azure App Service and Java
12
12
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.
14
14
15
15
## Enable Application Insights
16
16
17
17
The recommended way to enable application monitoring for Java applications running on Azure App Services is through Azure portal.
18
18
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.
20
20
21
21
### Auto-instrumentation through Azure portal
22
22
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.
24
24
25
25
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).
26
26
@@ -35,11 +35,11 @@ For a complete list of supported auto-instrumentation scenarios, see [Supported
35
35
36
36
:::image type="content"source="./media/azure-web-apps/change-resource.png" alt-text="Screenshot of Change your resource dropdown.":::
37
37
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.
39
39
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.
41
41
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.
43
43
44
44
:::image type="content"source="./media/azure-web-apps-java/create-app-service-ai.png" alt-text="Screenshot of instrument your application.":::
45
45
@@ -68,31 +68,45 @@ In order to enable telemetry collection with Application Insights, only the foll
68
68
69
69
## Troubleshooting
70
70
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.
72
72
73
73
1. Check that `ApplicationInsightsAgent_EXTENSION_VERSION` app setting is set to a value of "~2" on Windows, "~3" on Linux
74
74
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.
75
75
76
76
:::image type="content"source="./media/azure-web-apps-java/app-insights-java-status.png" alt-text="Screenshot of the link above results page.":::
77
77
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
## 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
+
96
110
## Release notes
97
111
98
112
For the latest updates and bug fixes, [consult the release notes](web-app-extension-release-notes.md).
0 commit comments