You can monitor a Go application in Application Real-Time Monitoring Service (ARMS) after you manually install the ARMS agent and deploy the application to Serverless App Engine (SAE). ARMS lets you view various monitoring data, such as application topology, call trace analysis, and SQL performance analysis. This topic describes how to manually install the ARMS agent for an 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 the Alibaba Cloud internal network. The security group for the build environment must allow outbound TCP traffic on ports 8080, 9990, 80, and 443.
Check your network environment. For more information, see Network configurations for Go application monitoring.
Verify the operating system and architecture of your image build environment, and check the Go version and framework version. For more information, see Go components and frameworks supported by ARMS Application Monitoring.
Limitations
This feature is applicable only to Go applications that are deployed from images.
Procedure
Prepare a project: This topic uses a demo project as an example.
Build an image and push it to an ACR image repository: Build an image for the project and push it to an Alibaba Cloud Container Registry (ACR) repository. This makes the image available 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 various monitoring data generated by the application.
Step 1: Prepare the project
Upload the Go project to your environment.
Step 2: Build an image and push it to an image repository
2.1. Build the image
This section provides only the commands to download the compilation tool and build the application.
-
Download the compilation tool.
# Download the wget command. RUN yum -y install wget # This topic uses the command to download the compilation tool from an internet endpoint in China (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, you must select the download endpoint based on the region of your build machine. For more information about the download endpoints, see Download commands for each region.
NoteThe compilation tool is the same for all regions. If your environment can access OSS over the Internet, you can use the endpoint for the China (Hangzhou) region to obtain the compilation tool for your operating system and architecture.
Add the execute permission to the binary file.
RUN chmod +x instgo-
Replace the
go buildcommand with./instgo buildto build the application.RUN ./instgo go build {args1} {args2}If you want to test the compilation or cannot obtain a license key, you can directly compile the application.
RUN ./instgo go build {args1} {args2}
2.2. Push the image to the image repository
Push the Go image that you built to an Alibaba Cloud Container Registry (ACR) repository. For more information, see Push and pull images using an Enterprise instance or Push and pull an image.
Step 3: Create a Go application
This section describes only the key steps. For detailed instructions about how to create an application, see Deploy an application from an image.
3.1. Create the application
-
On the Specify Image panel, set Technology Stack Programming Language to Go and select an image version.
Click the My Alibaba Cloud Images tab, select Personal Edition for Container Registry, and then select go-demo-2 as the image version from the image list.
-
In the Application Monitoring section of the Advanced Settings page, turn on Application Monitoring.
If you enable Application Monitoring, you must have already modified your custom image to manually install the ARMS agent during the build process. ARMS provides a free monthly quota of 200 GB for SAE users.
Click Create Application.
3.2. Test access
-
Add an Internet-facing endpoint for the application. For more information, see Attach a CLB instance to an application and generate an internet-facing or internal-facing IP address for the application.
After adding the endpoint, you can find the IP address and port of the bound internet-facing CLB instance, such as
xxx.xxx.xxx.xxx:2222, in the Internet-facing Endpoint section. The protocol isHTTP. Copy the Internet-facing endpoint and paste it into your browser to test access.
Step 4: View application monitoring data
-
Log on to the ARMS console. In the left-side navigation pane, choose . On the Application List page, click the application to view its monitoring data.
-
Log on to the SAE console. In the left-side navigation pane, choose . Click the name of your application to go to its Basic Information page. In the left-side navigation pane, click Application Monitoring to view the monitoring data.
The Application Overview page provides a summary of your application's health, displaying core metrics like requests, errors, average response time, and instance count, with day-over-day and week-over-week comparisons. The page also features trend charts, a honeycomb chart for peak CPU utilization, and top-five rankings for key performance indicators.