After you install an Application Real-Time Monitoring Service (ARMS) agent for a Go application, ARMS starts to monitor the application. Then, you can view the monitoring data of the application, such as the topology, traces, and SQL analysis. This topic describes how to manually install an ARMS agent for a Go application.
For applications deployed in Container Service for Kubernetes (ACK) clusters, we recommend that you install the ack-onepilot component rather than manually install an ARMS agent. For more information, see Install the ack-onepilot component for an ACK cluster.
If you have any questions when you use an ARMS agent, join the DingTalk group chat (ID: 35568145) for technical support.
Before you begin
Make sure the environment where the application resides is connected to Alibaba Cloud over the Internet or an internal network, and the security group of the environment allows outbound traffic for TCP ports 8080, 9990, 80, and 443.
Check the network configurations. For more information, see Network configurations required by the ARMS agent for Go.
Check the operating system and architecture of the environment, and the versions of Go and frameworks. For more information, see Go components and frameworks supported by ARMS.
Step 1: Compile the Go binary file
Run the
wget
command to download the compilation tool based on the region where the environment and machine reside.NoteIf you are able to access Object Storage Service (OSS) over the Internet, you can directly use the public endpoint of the operating system and architecture in the China (Hangzhou) region to obtain the compilation tool.
Grant the compilation tool the permissions required to perform the related operations.
Linux/Darwin
# Grant the permissions. chmod +x instgo
Windows
In Windows, you do not need to grant permissions.
(Optional) Obtain the license key and set the compilation parameter.
ImportantIf you skip this step, instgo enters Dev mode and installs the ARMS agent of the latest version by default. To deploy the agent in a production environment, you are recommended to set the DescribeTraceLicenseKey parameter.
You can call an operation to obtain the license key. For more information, see DescribeTraceLicenseKey.
After you obtain the license key, run the
set
command to set the compilation parameter.instgo set --licenseKey=${YourLicenseKey} --regionId=${YourRegionId} --dev=false
Add instgo as a prefix to your existing compilation command and run the following command:
instgo go build {arg1} {arg2} {arg3}
Use the binary file compiled in the previous step to build the image.
References
The following table describes the common Instgo commands.
Command
Flag
Parameter type
Description
Required
build
(compilation)--licenseKey, -l
String
The license key.
Yes (except for Dev Mode)
--dev
-
Specifies Dev Mode as the development mode. In this mode, you can compile data to test functionality without specifying the license key.
ImportantSome features are degraded. Do not use Dev Mode in a production environment.
No
--agentVersion
String
Specifies the version of the ARMS agent.
No
--agentPath
String
Specifies the local path of the ARMS agent.
No
--cacheDir
String
Specifies the cache directory of the ARMS agent.
No
--regionId, -r
String
The ID of the region from which the dependencies of the ARMS agent are downloaded. Default value: cn-hangzhou.
No
--timeout, -t
Integer
The timeout period for downloading the dependencies of the ARMS agent. Unit: seconds. Default value: 180.
No
--verbose, -v
-
Specifies whether to print detailed compilation logs.
No
--vpc
-
Specifies whether to download the dependencies of the ARMS agent over a virtual private cloud (VPC).
No
clean
(cleanup)
-
-
-
-
update
(update)--licenseKey, -l
String
The license key.
Yes
--cacheDir
String
Specifies the cache directory of the ARMS agent.
No
--regionId, -r
String
The ID of the region from which the dependencies of the ARMS agent are downloaded. Default value: cn-hangzhou.
No
--timeout, -t
Integer
The timeout period for downloading the dependencies of the ARMS agent. Unit: seconds. Default value: 180.
No
--vpc
Specifies whether to download the dependencies of the ARMS agent over a VPC.
No
version
(version)
-
-
-
-
The first time that you compile the application, the ARMS agent is downloaded to the
/opt
directory (C:\ProgramData
in Windows) by default. If you have no permissions on the directory, you can use the--cacheDir
flag to specify a cache directory or run thesudo -E
command to compile the agent. In Windows, run commands to compile the application as an administrator.If the compilation is forcibly stopped or killed, a residue may be caused. For information about how to clean up the residue, see Uninstall an ARMS agent for Go.
Step 2: Configure environment variables
After the compilation, add the following environment variables to the Go application.
export TYPE_IS_ARMS=true
export ARMS_APP_NAME=xxx # The name of the application.
export ARMS_REGION_ID=xxx # The region ID.
export ARMS_LICENSE_KEY=xxx # The license key obtained in Step 1.
(Optional) Sample Dockerfile
For a Docker environment, you can refer to the following sample Dockerfile to install an ARMS agent.
### .....
ENV TYPE_IS_ARMS=true
ENV ARMS_APP_NAME={AppName}
ENV ARMS_REGION_ID={regionId}
ENV ARMS_LICENSE_KEY={licenseKey}
### Add custom Dockerfile logic.
### ......
Verify the result
After about one minute, log on to the ARMS console. In the left-side navigation pane, choose . If the application is displayed on the Application List page, the application is being monitored.