To monitor Go applications in Container Service for Kubernetes (ACK) or Container Compute Service (ACS), install the ack-onepilot application monitoring component and compile your Go binary file. After the installation, you can view application topology, API calls, database analysis, and other monitoring data in Cloud Monitor 2.0. This topic describes how to install the probe for Go applications in Container Service for Kubernetes (ACK) or Container Compute Service (ACS).
About the ack-onepilot component
The Application Monitoring agent installation assistant, ack-onepilot, is a key component for installing agents for different languages. It automatically prepares the Application Monitoring agent package and configures the agent's reporting environment within a container. For more information about the basic principles of ack-onepilot, see Basic principles of the ack-onepilot component.
After the agent is installed, ack-onepilot automatically upgrades the agent to the latest version when the application is restarted and a new version of the agent is available. If you do not want the agent to be automatically updated with each new release, you can control the agent version. For more information, see Control the agent version.
Prerequisites
An ACK or ACS cluster is created.
ACK cluster: You can create an ACK managed cluster, ACK dedicated cluster, or ACK Serverless cluster, or a registered cluster, based on your business requirements.
ACS cluster: For information about how to create an ACS cluster, see Create an ACS cluster.
Create a namespace. This topic uses default as the namespace name. For more information, see Manage namespaces and quotas.
Check your compile-time operating system, architecture, Go version, and framework version. For more information, see Go libraries supported by Application Monitoring.
Step 1: Install the probe installation assistant (ack-onepilot)
Log on to the ACK console. On the Clusters page, click the name of the cluster.
In the navigation pane on the left, click Component Management. Then, search for ack-onepilot.
ImportantThe version of ack-onepilot must be 5.1.0 or later. The current version is in a grayscale release. To use this version, contact our DingTalk support group (Group ID: 35568145) for assistance.
Click Install on the ack-onepilot card.
NoteBy default, the ack-onepilot component supports 1,000 pods. For every additional 1,000 pods in the cluster, you must add 0.5 CPU cores and 512 MB memory for the component.
In the dialog box that appears, configure the parameters and click OK. We recommend that you use the default values.
NoteAfter you install ack-onepilot, you can upgrade, configure, or uninstall it on the Add-ons page.
Step 3: Compile the Golang application image
(Optional) If your project uses vendor mode for compilation or the compile-time parameters include
-mod=vendor, check the following:Check if the go.mod file contains the `google.golang.org/protobuf` dependency, either directly or indirectly. If not, see the following instructions:
Check if the compile-time parameters include
-mod=vendor. If not, add-mod=vendoraftergo build.
Use the
wgetcommand to download the compile-time tool instgo. Select the download address based on your compile-time environment and machine region.Note that instgo automatically updates at compile-time. Save instgo in a folder where you have modification permissions.
NoteInstgo is a compile-time tool provided by ARMS for Go applications. After you compile your Go project with instgo, ARMS can monitor your application.
The compile-time tool is the same for all regions. If your environment can access Object Storage Service (OSS) over the internet, you can use the internet download address for China (Hangzhou) for your operating system and architecture.
Grant executable permissions to the compile-time tool.
Linux/Mac
# Grant executable permissions chmod +x instgoWindows
No executable permissions are required for Windows.
Obtain the LicenseKey and configure compile-time parameters.
ImportantIf you skip this step, instgo enters dev mode and installs the latest version of the ARMS agent by default. To deploy your application in a production environment, you must configure the following parameters.
Obtain the LicenseKey by calling the DescribeTraceLicenseKey OpenAPI operation.
On the DescribeTraceLicenseKey page, click Debug. Select a region and click Initiate Call to obtain the LicenseKey.

After you obtain the LicenseKey, use the
setcommand to configure the compile-time parameters.instgo set --licenseKey=${YourLicenseKey}
Add `instgo` as a prefix to your original compile command and run the command.
instgo go build {arg1} {arg2} {arg3}If you use `go install` to compile the project, you can also add `instgo` as a prefix to the command.
Build the image using the binary file compiled in the previous step.
Step 4: Enable ARMS Application Monitoring for a Go application
The following sample YAML template creates a stateless (Deployment) application and enables ARMS Application Monitoring:
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, select the resource group and region of the target cluster in the upper-left corner. Click the name of the target cluster. In the navigation pane on the left, click Workloads, and then choose Stateless, Stateful, or DaemonSet.
To the right of the target application, choose .
To create a new application, click Create From YAML.
In the YAML file, add the following
labelsunder `spec.template.metadata`.labels: aliyun.com/app-language: golang # Required for Go applications. This label specifies that the application is a Go application. armsPilotAutoEnable: 'on' armsPilotCreateAppName: "deployment-name" # Replace deployment-name with your application name. armsPilotAppWorkspace: "workspace" # Replace this with the current Workspace name.
Click Update.
View monitoring details
Log on to the Cloud Monitor 2.0 console, and select a workspace. In the left navigation pane, choose .
On the Application List page, click an Application Name to view detailed application monitoring data.
> Edit YAML