After you install the ARMS agent for a Golang application and deploy it to SAE, you can use ARMS to monitor the application. With ARMS, you can view various types of monitoring data, such as application topology, call trace analysis, and SQL performance analysis. This topic describes how to install the ARMS agent for a Golang application and deploy it to SAE.
Prerequisites
Activate Container Registry and create an Enterprise instance or create a Personal instance.
Ensure that your image build environment can connect to the internet or an Alibaba Cloud internal network. The security group for the compile environment must allow outbound TCP traffic on ports 8080, 9990, 80, and 443.
Check your network environment. For more information, see Network configurations for Golang application monitoring.
Check the operating system and architecture of your image build environment, and the Go and framework versions. For more information, see Go components and frameworks supported by ARMS Application Monitoring.
Limitations
This feature applies only to Go applications that are deployed using images.
Procedure overview
Prepare the project: This topic uses a demo project as an example.
Build an image and upload it to an ACR image repository: Build an image from the project and push it to an Alibaba Cloud Container Registry (ACR) repository to prepare for creating a microservice application in SAE.
Create an application: Deploy the image from the image repository to SAE and access the application.
View application monitoring data: View the monitoring data that the application generates.
1. Prepare the project
Upload the Go project to your environment.
2. Build an image and push it to an image repository
2.1 Build the image
This section describes only the commands to download the compile tool and build the application.
Download the compile tool.
# Download the wget command. RUN yum -y install wget # This topic uses the command to download the compile tool from a public endpoint in Hangzhou as an example. RUN wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/instgo/instgo-linux-amd64" -O instgoIn a production environment, select the download URL based on the region of the build machine. For more information about the download URLs, see Download commands for each region.
NoteThe compile tool is the same for all regions. If your environment can access Object Storage Service (OSS) over the internet, you can use the public endpoint in Hangzhou for the corresponding operating system and architecture to obtain the compile tool.
Add execute permission to the binary file.
RUN chmod +x instgoObtain the LicenseKey by calling an OpenAPI. For more information, see DescribeTraceLicenseKey - List LicenseKeys.
Replace the
go buildcommand with./instgo buildto build the application.# Use the ./instgo build command to compile the Go project. # Replace {licenseKey} with the LicenseKey that you obtained in the previous step. RUN ./instgo build --licenseKey="{licenseKey}" --cacheDir=./To test the compilation or if you cannot obtain a LicenseKey, add
--devto enable the development compile mode. In this mode, you do not need to pass a LicenseKey.NoteIf your original compile command contains other compile parameters, add the
--separator after all options, and then add the parameters in their original format. Example:RUN ./instgo build --licenseKey="{licenseKey}" --cacheDir=./ -- {arg1} {arg2} ...During the first compilation, the agent is downloaded to the
/optdirectory by default. Use the--cacheDirflag to specify a cache directory.
2.2 Push the image to an image repository
Push the built Go image to an ACR image repository. For more information, see Push and pull images (Enterprise Edition) or Push and pull images (Personal Edition).
3. Create a Go application
This section describes only the key steps. For more information about how to create an application, see Deploy an application using an image.
3.1 Create the application
In the Set Image panel, set Technology Stack to Go, and then select an image version.

On the Advanced Settings page, in the Application Monitoring section, turn on Application Monitoring.

Click Create Application.
3.2 Test access
Add a public endpoint for the application. For more information, see Attach a CLB instance to an application and generate a public or private IP address for the application.

Copy the public endpoint and test access in a browser.
5. View application monitoring data
View data in the SAE console
Go to the Basic Information page of the application. In the navigation pane on the left, click Application Monitoring. On the Application Monitoring page, view the Monitoring Data.

View data in the ARMS console
Log on to the ARMS console.
In the navigation pane on the left, choose . In the top menu bar, select the destination region.

On the Application List page, search for your application and click its name.

View the monitoring data on the monitoring details page.
