|
| 1 | +--- |
| 2 | +title: Configure APM platforms for Tomcat, JBoss, or Java SE apps |
| 3 | +description: Learn how to configure APM platforms, such as Application Insights, NewRelic, and AppDynamics, for Tomcat, JBoss, or Java SE app on Azure App Service. |
| 4 | +keywords: azure app service, web app, windows, oss, java, tomcat, jboss, spring boot, quarkus |
| 5 | +ms.devlang: java |
| 6 | +ms.topic: article |
| 7 | +ms.date: 07/17/2024 |
| 8 | +ms.custom: devx-track-java, devx-track-azurecli, devx-track-extended-java, linux-related-content |
| 9 | +zone_pivot_groups: app-service-java-hosting |
| 10 | +adobe-target: true |
| 11 | +author: cephalin |
| 12 | +ms.author: cephalin |
| 13 | +--- |
| 14 | + |
| 15 | +# Configure APM platforms for Tomcat, JBoss, or Java SE apps in Azure App Service |
| 16 | + |
| 17 | +This article shows how to connect Java applications deployed on Azure App Service with Azure Monitor Application Insights, NewRelic, and AppDynamics application performance monitoring (APM) platforms. |
| 18 | + |
| 19 | +[!INCLUDE [java-variants](includes/configure-language-java/java-variants.md)] |
| 20 | + |
| 21 | +## Configure Application Insights |
| 22 | + |
| 23 | +Azure Monitor Application Insights is a cloud native application monitoring service that enables customers to observe failures, bottlenecks, and usage patterns to improve application performance and reduce mean time to resolution (MTTR). With a few clicks or CLI commands, you can enable monitoring for your Node.js or Java apps, autocollecting logs, metrics, and distributed traces, eliminating the need for including an SDK in your app. For more information about the available app settings for configuring the agent, see the [Application Insights documentation](../azure-monitor/app/java-standalone-config.md). |
| 24 | + |
| 25 | +# [Azure portal](#tab/portal) |
| 26 | + |
| 27 | +To enable Application Insights from the Azure portal, go to **Application Insights** on the left-side menu and select **Turn on Application Insights**. By default, a new application insights resource of the same name as your web app is used. You can choose to use an existing application insights resource, or change the name. Select **Apply** at the bottom. |
| 28 | + |
| 29 | +# [Azure CLI](#tab/cli) |
| 30 | + |
| 31 | +To enable via the Azure CLI, you need to create an Application Insights resource and set a couple app settings on the Azure portal to connect Application Insights to your web app. |
| 32 | + |
| 33 | +1. Enable the Applications Insights extension |
| 34 | + |
| 35 | + ```azurecli |
| 36 | + az extension add -n application-insights |
| 37 | + ``` |
| 38 | +
|
| 39 | +2. Create an Application Insights resource using the following CLI command. Replace the placeholders with your desired resource name and group. |
| 40 | +
|
| 41 | + ```azurecli |
| 42 | + az monitor app-insights component create --app <resource-name> -g <resource-group> --location westus2 --kind web --application-type web |
| 43 | + ``` |
| 44 | +
|
| 45 | + Note the values for `connectionString` and `instrumentationKey`, you'll need these values in the next step. |
| 46 | +
|
| 47 | + > [!NOTE] |
| 48 | + > To retrieve a list of other locations, run `az account list-locations`. |
| 49 | +
|
| 50 | +3. Set the instrumentation key, connection string, and monitoring agent version as app settings on the web app. Replace `<instrumentationKey>` and `<connectionString>` with the values from the previous step. |
| 51 | +
|
| 52 | + # [Windows](#tab/windows) |
| 53 | +
|
| 54 | + ```azurecli |
| 55 | + az webapp config appsettings set -n <webapp-name> -g <resource-group> --settings "APPINSIGHTS_INSTRUMENTATIONKEY=<instrumentationKey>" "APPLICATIONINSIGHTS_CONNECTION_STRING=<connectionString>" "ApplicationInsightsAgent_EXTENSION_VERSION=~3" "XDT_MicrosoftApplicationInsights_Mode=default" "XDT_MicrosoftApplicationInsights_Java=1" |
| 56 | + ``` |
| 57 | +
|
| 58 | + # [Linux](#tab/linux) |
| 59 | + |
| 60 | + ```azurecli |
| 61 | + az webapp config appsettings set -n <webapp-name> -g <resource-group> --settings "APPINSIGHTS_INSTRUMENTATIONKEY=<instrumentationKey>" "APPLICATIONINSIGHTS_CONNECTION_STRING=<connectionString>" "ApplicationInsightsAgent_EXTENSION_VERSION=~3" "XDT_MicrosoftApplicationInsights_Mode=default" |
| 62 | + ``` |
| 63 | +
|
| 64 | + --- |
| 65 | +
|
| 66 | +--- |
| 67 | +
|
| 68 | +## Configure New Relic |
| 69 | +
|
| 70 | +# [Windows](#tab/windows) |
| 71 | +
|
| 72 | +1. Create a NewRelic account at [NewRelic.com](https://newrelic.com/signup) |
| 73 | +2. Download the Java agent from NewRelic. It has a file name similar to *newrelic-java-x.x.x.zip*. |
| 74 | +3. Copy your license key, you need it to configure the agent later. |
| 75 | +4. [SSH into your App Service instance](configure-linux-open-ssh-session.md) and create a new directory */home/site/wwwroot/apm*. |
| 76 | +5. Upload the unpacked NewRelic Java agent files into a directory under */home/site/wwwroot/apm*. The files for your agent should be in */home/site/wwwroot/apm/newrelic*. |
| 77 | +6. Modify the YAML file at */home/site/wwwroot/apm/newrelic/newrelic.yml* and replace the placeholder license value with your own license key. |
| 78 | +7. In the Azure portal, browse to your application in App Service and create a new Application Setting. |
| 79 | +
|
| 80 | + ::: zone pivot="java-javase" |
| 81 | + |
| 82 | + Create an environment variable named `JAVA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/newrelic/newrelic.jar`. |
| 83 | +
|
| 84 | + ::: zone-end |
| 85 | +
|
| 86 | + ::: zone pivot="java-tomcat" |
| 87 | +
|
| 88 | + Create an environment variable named `CATALINA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/newrelic/newrelic.jar`. |
| 89 | +
|
| 90 | + ::: zone-end |
| 91 | +
|
| 92 | + ::: zone pivot="java-jboss" |
| 93 | +
|
| 94 | + For **JBoss EAP**, `[TODO]`. |
| 95 | +
|
| 96 | + ::: zone-end |
| 97 | +
|
| 98 | +# [Linux](#tab/linux) |
| 99 | +
|
| 100 | +1. Create a NewRelic account at [NewRelic.com](https://newrelic.com/signup) |
| 101 | +2. Download the Java agent from NewRelic. It has a file name similar to *newrelic-java-x.x.x.zip*. |
| 102 | +3. Copy your license key, you need it to configure the agent later. |
| 103 | +4. [SSH into your App Service instance](configure-linux-open-ssh-session.md) and create a new directory */home/site/wwwroot/apm*. |
| 104 | +5. Upload the unpacked NewRelic Java agent files into a directory under */home/site/wwwroot/apm*. The files for your agent should be in */home/site/wwwroot/apm/newrelic*. |
| 105 | +6. Modify the YAML file at */home/site/wwwroot/apm/newrelic/newrelic.yml* and replace the placeholder license value with your own license key. |
| 106 | +7. In the Azure portal, browse to your application in App Service and create a new Application Setting. |
| 107 | +
|
| 108 | + ::: zone pivot="java-javase" |
| 109 | + |
| 110 | + Create an environment variable named `JAVA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/newrelic/newrelic.jar`. |
| 111 | +
|
| 112 | + ::: zone-end |
| 113 | +
|
| 114 | + ::: zone pivot="java-tomcat" |
| 115 | +
|
| 116 | + Create an environment variable named `CATALINA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/newrelic/newrelic.jar`. |
| 117 | +
|
| 118 | + ::: zone-end |
| 119 | +
|
| 120 | + ::: zone pivot="java-jboss" |
| 121 | +
|
| 122 | + For **JBoss EAP**, `[TODO]`. |
| 123 | +
|
| 124 | + ::: zone-end |
| 125 | +
|
| 126 | +--- |
| 127 | +
|
| 128 | +> [!NOTE] |
| 129 | +> If you already have an environment variable for `JAVA_OPTS` or `CATALINA_OPTS`, append the `-javaagent:/...` option to the end of the current value. |
| 130 | +
|
| 131 | +## Configure AppDynamics |
| 132 | +
|
| 133 | +# [Windows](#tab/windows) |
| 134 | +
|
| 135 | +1. Create an AppDynamics account at [AppDynamics.com](https://www.appdynamics.com/community/register/) |
| 136 | +2. Download the Java agent from the AppDynamics website. The file name is similar to *AppServerAgent-x.x.x.xxxxx.zip* |
| 137 | +3. Use the [Kudu console](https://github.com/projectkudu/kudu/wiki/Kudu-console) to create a new directory */home/site/wwwroot/apm*. |
| 138 | +4. Upload the Java agent files into a directory under */home/site/wwwroot/apm*. The files for your agent should be in */home/site/wwwroot/apm/appdynamics*. |
| 139 | +5. In the Azure portal, browse to your application in App Service and create a new Application Setting. |
| 140 | +
|
| 141 | + ::: zone pivot="java-javase" |
| 142 | + |
| 143 | + Create an environment variable named `JAVA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/appdynamics/javaagent.jar -Dappdynamics.agent.applicationName=<app-name>` where `<app-name>` is your App Service name. If you already have an environment variable for `JAVA_OPTS`, append the `-javaagent:/...` option to the end of the current value. |
| 144 | +
|
| 145 | + ::: zone-end |
| 146 | +
|
| 147 | + ::: zone pivot="java-tomcat" |
| 148 | +
|
| 149 | + Create an environment variable named `CATALINA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/appdynamics/javaagent.jar -Dappdynamics.agent.applicationName=<app-name>` where `<app-name>` is your App Service name. If you already have an environment variable for `CATALINA_OPTS`, append the `-javaagent:/...` option to the end of the current value. |
| 150 | +
|
| 151 | + ::: zone-end |
| 152 | +
|
| 153 | + ::: zone pivot="java-jboss" |
| 154 | +
|
| 155 | + For **JBoss EAP**, `[TODO]`. |
| 156 | +
|
| 157 | + ::: zone-end |
| 158 | +
|
| 159 | +# [Linux](#tab/linux) |
| 160 | +
|
| 161 | +1. Create an AppDynamics account at [AppDynamics.com](https://www.appdynamics.com/community/register/) |
| 162 | +2. Download the Java agent from the AppDynamics website. The file name is similar to *AppServerAgent-x.x.x.xxxxx.zip* |
| 163 | +3. [SSH into your App Service instance](configure-linux-open-ssh-session.md) and create a new directory */home/site/wwwroot/apm*. |
| 164 | +4. Upload the Java agent files into a directory under */home/site/wwwroot/apm*. The files for your agent should be in */home/site/wwwroot/apm/appdynamics*. |
| 165 | +5. In the Azure portal, browse to your application in App Service and create a new Application Setting. |
| 166 | +
|
| 167 | + ::: zone pivot="java-javase" |
| 168 | +
|
| 169 | + Create an environment variable named `JAVA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/appdynamics/javaagent.jar -Dappdynamics.agent.applicationName=<app-name>` where `<app-name>` is your App Service name. If you already have an environment variable for `JAVA_OPTS`, append the `-javaagent:/...` option to the end of the current value. |
| 170 | +
|
| 171 | + ::: zone-end |
| 172 | +
|
| 173 | + ::: zone pivot="java-tomcat" |
| 174 | +
|
| 175 | + Create an environment variable named `CATALINA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/appdynamics/javaagent.jar -Dappdynamics.agent.applicationName=<app-name>` where `<app-name>` is your App Service name. If you already have an environment variable for `CATALINA_OPTS`, append the `-javaagent:/...` option to the end of the current value. |
| 176 | +
|
| 177 | + ::: zone-end |
| 178 | +
|
| 179 | + ::: zone pivot="java-jboss" |
| 180 | +
|
| 181 | + For **JBoss EAP**, `[TODO]`. |
| 182 | +
|
| 183 | + ::: zone-end |
| 184 | +
|
| 185 | +--- |
| 186 | +
|
| 187 | +## Configure Datadog |
| 188 | +
|
| 189 | +# [Windows](#tab/windows) |
| 190 | +* The configuration options are different depending on which Datadog site your organization is using. See the official [Datadog Integration for Azure Documentation](https://docs.datadoghq.com/integrations/azure/) |
| 191 | +
|
| 192 | +# [Linux](#tab/linux) |
| 193 | +* The configuration options are different depending on which Datadog site your organization is using. See the official [Datadog Integration for Azure Documentation](https://docs.datadoghq.com/integrations/azure/) |
| 194 | +
|
| 195 | +--- |
| 196 | +
|
| 197 | +## Configure Dynatrace |
| 198 | +
|
| 199 | +# [Windows](#tab/windows) |
| 200 | +* Dynatrace provides an [Azure Native Dynatrace Service](https://www.dynatrace.com/monitoring/technologies/azure-monitoring/). To monitor Azure App Services using Dynatrace, see the official [Dynatrace for Azure documentation](https://docs.datadoghq.com/integrations/azure/) |
| 201 | +
|
| 202 | +# [Linux](#tab/linux) |
| 203 | +* Dynatrace provides an [Azure Native Dynatrace Service](https://www.dynatrace.com/monitoring/technologies/azure-monitoring/). To monitor Azure App Services using Dynatrace, see the official [Dynatrace for Azure documentation](https://docs.datadoghq.com/integrations/azure/) |
| 204 | +
|
| 205 | +--- |
| 206 | +
|
| 207 | +## Next steps |
| 208 | +
|
| 209 | +Visit the [Azure for Java Developers](/java/azure/) center to find Azure quickstarts, tutorials, and Java reference documentation. |
| 210 | +
|
| 211 | +- [App Service Linux FAQ](faq-app-service-linux.yml) |
| 212 | +- [Environment variables and app settings reference](reference-app-settings.md) |
0 commit comments