Application Real-Time Monitoring Service (ARMS) monitors Go applications in a Container Service for Kubernetes (ACK) cluster. Install the ack-onepilot add-on, compile the Go binary file with the instgo build tool, and build the container image. After deployment, view monitoring data such as the application topology, interface calls, and database analysis.
Prerequisites
You have created an ACK cluster. An ACK managed cluster is recommended. For instructions, see Create an ACK managed cluster.
New creation of ACK dedicated clusters is no longer available, but existing dedicated clusters remain supported. For more information, see Create an ACK dedicated cluster (discontinued).
Your Go application uses Go 1.18 or later.
You have activated ARMS.
ARMS is an Alibaba Cloud application performance management (APM) service. For more information about ARMS, see What is ARMS? and What is Application Monitoring?
Step 1: Install ack-onepilot, the ARMS application monitoring add-on
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of your cluster. In the left-side navigation pane, click Components and Add-ons.
Make sure that the version of ack-onepilot is 3.2.4 or later. By default, the ack-onepilot add-on supports up to 1,000 pods. For every 1,000 pods that exceed this limit, increase the CPU resources for ack-onepilot by 0.5 cores and the memory resources by 512 MB.
Step 2: Compile the Go binary file and build the container image
Use the enhanced Go build tool instgo together with a local Go build environment (Go 1.18 or later) to compile your Go program into a binary file that reports monitoring data to ARMS.
(Optional) If your project includes a vendor directory during the build, add
-mod=vendoraftergo build.Use the
wgetcommand to download the instgo build tool.During the build process, instgo updates automatically. Save instgo in a directory where the build user has write permissions.
Noteinstgo is a build tool from ARMS that instruments your Go project, enabling ARMS to monitor your application.
If your build environment has internet access to Object Storage Service (OSS), select the China (Hangzhou) internet download URL that corresponds to the operating system and architecture of the build environment.
Download commands
Linux (AMD64)
wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/instgo/instgo-linux-amd64" -O instgoLinux (ARM64)
wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/instgo/instgo-linux-arm64" -O instgoMac (ARM64)
wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/instgo/instgo-darwin-arm64" -O instgoMac (AMD64)
wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/instgo/instgo-darwin-amd64" -O instgoWindows (AMD64)
wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/instgo/instgo-windows-amd64.exe" -O instgo.exeMake the build tool executable.
Linux/Mac
# Grant the executable permission. chmod +x instgoWindows
You do not need to grant the executable permission on Windows.
(Optional) Configure a UID as a build parameter.
ImportantIf you skip this step, instgo installs the latest version of the ARMS agent by default.
Configuring a UID requires instgo 1.4.5 or later. Use the
setcommand to configure a UID as a build parameter.# The UID is the ID of your Alibaba Cloud primary account. instgo set --uid={YourAliyunUid}Add
instgoas a prefix to your original build command and run the command.instgo go build {arg1} {arg2} {arg3}If you use
go installto build the project, you can also addinstgoas a prefix to your original build command.Use the binary file generated in the previous step to build the container image.
Step 3: Enable ARMS application monitoring for your Go application
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of your cluster. In the left-side navigation pane, choose Workloads > Deployments.
On the Deployments page, find your application and click Edit YAML in the Actions column.
In the YAML file, add the following
labelsto thespec.template.metadatalevel.labels: aliyun.com/app-language: golang # Required for Go applications. This indicates that this is a Go application. armsPilotAutoEnable: 'on' armsPilotCreateAppName: "<YOUR-DEPLOYMENT-NAME>" # Replace <YOUR-DEPLOYMENT-NAME> with your application name.
Step 4: View monitoring details
After about one minute, go to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Applications to view the Go application and the data that it reports.
An application named otel-go-server appears in the application list. A green status indicates that the application runs normally. View monitoring metrics such as requests per second, error rate, and average response time to confirm that data is reported.
In the Application Name column, click the name of your application to go to the application monitoring page of the ARMS console and view the monitoring details. For more information, see Application overview.
(Optional) Step 5: Release resources
If you no longer need to monitor the application, uninstall the ARMS agent. For more information, see Uninstall the ARMS agent for Go.