In this tutorial, you will learn how to set up a metrics dashboard using Azure Managed Grafana to monitor Java applications running in Azure Container Apps.
Grafana is a popular tool for centralized metrics visualization and monitoring in the observability industry. Azure Managed Grafana is a fully managed Azure service that allows you to deploy and manage Grafana dashboards with seamless Azure integration. You can use Azure Managed Grafana to visualize Java metrics exposed by Azure Container Apps or integrate Java metrics into your existing Grafana dashboards.
In this tutorial, you:
Use the following steps to define environment variables and ensure your Azure Managed Grafana extension is up to date.
Create variables to support your Grafana configuration.
export LOCATION=eastus
export SUBSCRIPTION_ID={subscription-id}
export RESOURCE_GROUP=grafana-resource-group
export GRAFANA_INSTANCE_NAME=grafana-name
Variable Description LOCATION
The Azure region location where you create your Azure Managed Grafana instance. SUBSCRIPTION_ID
The subscription ID which you use to create your Azure Container Apps and Azure Managed Grafana instance. RESOURCE_GROUP
The Azure resource group name for your Azure Managed Grafana instance. GRAFANA_INSTANCE_NAME
The instance name for your Azure Managed Grafana instance.Log in to Azure with the Azure CLI.
az login
Create a resource group.
az group create --name $RESOURCE_GROUP --location $LOCATION
Use the following command to ensure that you have the latest version of the Azure CLI extensions for Azure Managed Grafana.
az extension add --name amg --upgrade
First, create an Azure Managed Grafana instance, and grant necessary role assignments.
Create an Azure Managed Grafana instance.
az grafana create \
--name $GRAFANA_INSTANCE_NAME \
--resource-group $RESOURCE_GROUP \
--location $LOCATION
Grant the Azure Managed Grafana instance "Monitoring Reader" role to read metrics from Azure Monitor. Find more about the authentication and permissions for Azure Managed Grafana.
GRAFA_IDDENTITY=$(az grafana show --name $GRAFANA_INSTANCE_NAME --resource-group $RESOURCE_GROUP --query "identity.principalId" --output tsv)
az role assignment create --assignee $GRAFA_IDDENTITY --role "Monitoring Reader" --scope /subscriptions/$SUBSCRIPTION_ID
Assign the Grafana Admin
role to your account on the Azure Managed Grafana resource.
Get the resource ID for your Azure Managed Grafana instance.
GRAFANA_RESOURCE_ID=$(az grafana show --resource-group $RESOURCE_GROUP --name $GRAFANA_INSTANCE_NAME --query id --output tsv)
Before running this command, replace the <USER_OR_SERVICE_PRINCIPAL_ID>
placeholder with your user or service principal ID.
az role assignment create \
--assignee <USER_OR_SERVICE_PRINCIPAL_ID> \
--role "Grafana Admin" \
--scope $GRAFANA_RESOURCE_ID
Download the sample Java metric dashboard for Azure Container Apps json file.
Get the endpoint of the Azure Managed Grafana resource.
az grafana show --resource-group $RESOURCE_GROUP \
--name $GRAFANA_INSTANCE_NAME \
--query "properties.endpoint" \
--output tsv
This command returns the URL you can use to access the Azure Managed Grafana dashboard. Open your browser with URL and login.
Go to Dashboard
> New
-> Import
. Upload the above sample dashboard JSON file, and choose the default built-in Azure Monitor
data source, then click Import
button.
Input your resource information in the filters for your Azure Container Apps. Now you can view all the supported Java metrics in Azure Container Apps within the dashboard. The sample dashboard provides live metric data, including
You can use this dashboard as a starting point to create your own customized metric visualizations and monitoring solution.
Clean up resourcesThe resources created in this tutorial have an effect on your Azure bill. If you aren't going to use these services long-term, run the following command to remove everything created in this tutorial.
az group delete --resource-group $RESOURCE_GROUP
Java metrics for Java apps in Azure Container Apps
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4