This topic will walk you through the process for using the Application Monitoring sub-service of Application Real-Time Monitoring Service (ARMS) to monitor a Java application deployed in an Alibaba Cloud Container Service for Kubernetes (ACK) cluster. You can analyze application performance and traces, and configure alerting for the application.
For information about how to monitor Java applications deployed in other environments, see Application monitoring.
Workflow
Install an ARMS agent for the application.
Install the ack-onepilot component (ack-onepilot): The ack-onepilot component is provided by ACK to connect Java or Go applications deployed in ACK clusters to ARMS.
Update the YAML file: You can add
labelsto the YAML file of the application to enable monitoring through ARMS and configure the application name shown in ARMS.
View monitoring data.
Configure alerting.
Prerequisites
ACK:
An ACK dedicated cluster, an ACK managed cluster, or a registered cluster is created. For more information, see Create an ACK managed cluster.
A Java application is created. Notes:
For information about the JDK versions, see Java components and frameworks supported by ARMS.
The maximum heap memory of each process must be greater than 256 MB.
If you do not have a Java application, you can use the following YAML template to create one. For more information, see Create a stateless application by using a Deployment.
NoteThe YAML template creates the following resources:
Namespace: arms-demo. All of the following resources are created in the arms-demo namespace.
Deployments: arms-springboot-demo and arms-springboot-demo-subcomponent.
Service: arms-demo-component.
Database: arms-demo-mysql.
ARMS:
Application Monitoring is activated, and the pay-by-observable-data billing mode is enabled.
Application Monitoring provides a free monthly quota of 50 GB. The quota of a month cannot be used after the end of the month. If the quota is used up, you are charged based on the excess observable data. For more information, see Billing.
Install an ARMS agent
Step 1: Install the ack-onepilot component
Log on to the ACK console. On the Clusters page, click the name of the cluster.
In the left-side navigation pane, click . On the Add-ons page, search for ack-onepilot.
In the ack-onepilot section, click Install. In the dialog box that appears, click OK.

Step 2: Update the YAML file
In the left-side navigation pane, choose . On the page that appears, select the namespace where the Deployments reside. Find a Deployment and choose in the Actions column.
In the Edit YAML dialog box, add the following
labelsto the spec.template.metadata parameter and click Update.labels: armsPilotAutoEnable: "on" armsPilotCreateAppName: "<your-deployment-name>" # Specify the display name of the Deployment in ARMS.For example, you can modify the YAML files of the arms-springboot-demo and arms-springboot-demo-subcomponent Deployments, enable ARMS monitoring for the Deployments, and set arms-k8s-demo and arms-k8s-demo-subcomponent as their names shown in ARMS.
arms-springboot-demo Deployment

arms-springboot-demo-subcomponent Deployment

After the Deployments are automatically redeployed, wait for 1 to 2 minutes. In the left-side navigation pane of the ARMS console, choose . On the page that appears, click the name of each Deployment to view the metrics. For more information, see View monitoring details (new).

View the monitoring details
Trace Explorer
Trace Explorer allows you to combine filter conditions and aggregation dimensions for real-time analysis. You can troubleshoot failed or slow calls of your application based on the failed or slow trace data.
arms-k8s-demo application

Trace details

arms-k8s-demo-subcomponent application

Trace details

Metrics
Application overview
arms-k8s-demo application

arms-k8s-demo-subcomponent application

Topology
arms-k8s-demo application

arms-k8s-demo-subcomponent application

Configure alerting
You can configure alerting for the application. If an alert is triggered, alert notifications are sent to the contacts or DingTalk group chat based on the specified notification methods. For more information, see Alert rules.

Release resources
You can perform the following operations after you complete the whole process:
If you still want to monitor the application, make sure that your Alibaba Cloud account does not have overdue payments.
If you no longer want to monitor the application, uninstall the ARMS agent. For more information, see Uninstall an ARMS agent for Java.
References
ARMS provides various trace sampling modes. You can select an appropriate mode based on your scenarios so that you can obtain the trace data that you want at a low cost. For more information, see Select a trace sampling mode for the ARMS agent V3.2.8 and later.
Application Monitoring allows you to associate trace IDs with the business logs of an application. This way, when an error occurs in your application, you can access the business logs associated with trace IDs to troubleshoot the error. For more information, see Associate trace IDs with logs for a Java application.
If your application in a production environment has high CPU utilization or memory usage, or a large number of slow calls, you can use the flame graph generated by the continuous profiling feature to locate the root causes. For more information, see Continuous profiling for Java applications.
Alibaba Cloud Managed Service for Prometheus integrates with the Application Monitoring data source to visualize metrics. You can obtain application monitoring data, view preset dashboards, and perform secondary development based on your business requirements in Managed Service for Prometheus. For more information, see Use Managed Service for Prometheus to obtain application monitoring data.
> Edit YAML