Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.
The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.
This article applies to: ✅ Standard consumption and dedicated (Preview) ✅ Basic/Standard ❎ Enterprise
This article shows you how to monitor of Spring Boot applications in Azure Spring Apps with the New Relic Java agent.
With the New Relic Java agent, you can:
The following video describes how to activate and monitor Spring Boot applications in Azure Spring Apps using New Relic One.
Use the following procedure to access the agent:
Create an instance of Azure Spring Apps.
Create an application.
az spring app create \
--resource-group <resource-group-name> \
--service <Azure-Spring-Apps-instance-name> \
--name <app-name> \
--is-public true \
Create a deployment with the New Relic agent and environment variables.
az spring app deploy \
--resource-group <resource-group-name> \
--service <Azure-Spring-Apps-instance-name> \
--name <app-name> \
--artifact-path app.jar \
--jvm-options="-javaagent:/opt/agents/newrelic/java/newrelic-agent.jar" \
--env NEW_RELIC_APP_NAME=appName \
NEW_RELIC_LICENSE_KEY=newRelicLicenseKey
Azure Spring Apps preinstalls the New Relic Java agent to /opt/agents/newrelic/java/newrelic-agent.jar. Customers can activate the agent from applications' JVM options, and configure the agent using the New Relic Java agent environment variables.
You can also activate this agent from the Azure portal with the following procedure.
In your Azure Spring Apps instance, select Apps in the navigation pane.
Select the application from the list, and then select Configuration in the navigation pane.
Use the General settings tab to update values such as the JVM options.
Select Environment variables to add or update the variables used by your application.
View the application api/gateway Summary page from the New Relic dashboard.
View the application customers-service Summary page from the New Relic dashboard.
View the Service Map page from the New Relic dashboard.
View the JVMs page of the application from the New Relic dashboard.
View the application profile from the New Relic dashboard.
You can also run a provisioning automation pipeline using Terraform, Bicep, or an Azure Resource Manager template (ARM template). This pipeline can provide a complete hands-off experience to instrument and monitor any new applications that you create and deploy.
To configure the environment variables in a Terraform template, add the following code to the template, replacing the <...>
placeholders with your own values. For more information, see Manages an Active Azure Spring Apps Deployment.
resource "azurerm_spring_cloud_java_deployment" "example" {
...
jvm_options = "-javaagent:/opt/agents/newrelic/java/newrelic-agent.jar"
...
environment_variables = {
"NEW_RELIC_APP_NAME": "<app-name>",
"NEW_RELIC_LICENSE_KEY": "<new-relic-license-key>"
}
}
To configure the environment variables in a Bicep file, add the following code to the template, replacing the <...>
placeholders with your own values. For more information, see Microsoft.AppPlatform Spring/apps/deployments.
deploymentSettings: {
environmentVariables: {
NEW_RELIC_APP_NAME : '<app-name>',
NEW_RELIC_LICENSE_KEY : '<new-relic-license-key>'
},
jvmOptions: '-javaagent:/opt/agents/newrelic/java/newrelic-agent.jar',
...
}
To configure the environment variables in an ARM template, add the following code to the template, replacing the <...>
placeholders with your own values. For more information, see Microsoft.AppPlatform Spring/apps/deployments.
"deploymentSettings": {
"environmentVariables": {
"NEW_RELIC_APP_NAME" : "<app-name>",
"NEW_RELIC_LICENSE_KEY" : "<new-relic-license-key>"
},
"jvmOptions": "-javaagent:/opt/agents/newrelic/java/newrelic-agent.jar",
...
}
The New Relic agent can collect application logs directly from your apps, and forward them to New Relic. For more information, see Forward your logs to New Relic and APM logs in context.
By default, Azure Spring Apps prints the logs of the New Relic Java agent to STDOUT
. The logs are mixed with the application logs. You can find the explicit agent version from the application logs.
You can also get the logs of the New Relic agent from the following locations:
You can use some environment variables provided by New Relic to configure the logging of the New Agent, such as, NEW_RELIC_LOG_LEVEL
to control the level of logs. For more information, see New Relic logging configuration.
Note
Do not use finer
or finest
unless New Relic Support asks you to do that. These logging levels can generate excessive overhead. For most situations, use info
.
Caution
We strongly recommend that you don't override the logging default behavior provided by Azure Spring Apps for New Relic. If you do, the logging scenarios previously described are blocked, and the log file(s) may be lost. For example, you shouldn't pass the following environment variables to your applications. Log file(s) may be lost after restart or redeployment of application(s).
The New Relic Java agent update/upgrade the JDK regularly. The agent update/upgrade may affect following scenarios.
For a vnet injection instance of Azure Spring Apps, you need to make sure the outbound traffic is configured correctly for the New Relic Java agent. For more information, see Networks of New Relic.
Use Application Insights Java In-Process Agent in Azure Spring Apps
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Monitoring Java applications on Azure - Training
Learn how to use monitoring for your Java applications on Azure