All Products
Search
Document Center

Serverless App Engine:Install an agent for a Go application

Last Updated:Jun 20, 2026

After you manually 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 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

Limitations

This feature applies only to Go applications deployed using an image.

Overview

  1. Prepare a project: This topic uses a demo project as an example.

  2. Build an image and push it to an ACR image repository: Build an image from the project and push it to an Alibaba Cloud ACR repository to create a microservice application in SAE.

  3. Create an application: Deploy the image from the image repository to SAE and access the application.

  4. View application monitoring data: View various types of monitoring data generated by the application.

1. Prepare the project

Upload the Go project to your environment.

2. Build image and push to repository

2.1 Build the image

This section provides the commands to download the compile tool and build the application.

  1. Download the compile tool.

    # Download the wget command.
    RUN yum -y install wget
    # This example shows how to download the compile tool from the public endpoint in the China (Hangzhou) region.
    RUN wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/instgo/instgo-linux-amd64" -O instgo

    In a production environment, select a download address based on the region where your build machine is located. For a list of download addresses, see Download commands for each region.

    Note

    The compile tool is the same binary for all regions. If your environment can access OSS over the public internet, you can use the public endpoint for China (Hangzhou) to download the compile tool for your OS and architecture.

  2. Add the execute permission to the binary file.

    RUN chmod +x instgo
  3. Call OpenAPI to obtain the LicenseKey. For more information, see ListLicenseKey.

  4. Replace the go build command with the ./instgo build command to build the application.

    # Use the ./instgo build command to compile the Go project.
    # Replace {licenseKey} with the LicenseKey that you obtained in the preceding step.
    RUN ./instgo build --licenseKey="{licenseKey}" --cacheDir=./

    If you want to test the build or cannot obtain a LicenseKey yet, you can add the --dev flag to enable development mode. In this mode, you do not need to pass a LicenseKey.

    Note

    If your original build command includes additional build arguments, add them after a -- separator. For example:

    RUN ./instgo build --licenseKey="{licenseKey}" --cacheDir=./ -- {arg1} {arg2} ...
    • instgo command reference

      Command

      Flag

      Type

      Description

      Required

      build (compile)

      --licenseKey, -l

      string

      Specifies the ARMS LicenseKey.

      Yes (optional in development mode)

      --dev

      -

      Enables development mode. In this mode, you can compile without a LicenseKey to test the build.

      No

      --agentVersion

      string

      Specifies the agent version.

      No

      --agentPath

      string

      Specifies the local agent path.

      No

      --cacheDir

      string

      Specifies the agent cache directory.

      No

      --regionId, -r

      string

      Specifies the region ID for the OSS that stores agent dependencies. Default value: cn-hangzhou.

      No

      --timeout, -t

      int

      Specifies the timeout period for pulling the agent. Default value: 180 seconds.

      No

      --verbose, -v

      -

      Prints detailed compile logs.

      No

      --vpc

      -

      When enabled, agent package dependencies are pulled over the internal network by default.

      No

      clean

      (Clears artifacts)

      -

      -

      -

      -

      update (Updates the agent)

      --licenseKey, -l

      string

      Specifies the ARMS LicenseKey.

      Yes

      --cacheDir

      string

      Specifies the agent cache directory.

      No

      --regionId, -r

      string

      Specifies the ID of the region where the OSS that stores agent package dependencies is located. Default value: cn-hangzhou.

      No

      --timeout, -t

      int

      Specifies the timeout period for pulling the agent. Default value: 180 seconds.

      No

      --vpc

      -

      When enabled, agent package dependencies are pulled over the internal network by default.

      No

      version

      (Prints the version number)

      -

      -

      -

      -

    • During the first build, the agent is downloaded to the /opt directory by default. You can use the --cacheDir flag to specify a custom cache directory.

2.2 Push image to repository

Push the built Go image to an Alibaba Cloud 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 covers only the key steps. For the full procedure, see Deploy an application using an image.

3.1 Create the application

  1. On the Specify Image panel, set Technology Stack Programming Language to Go, and then select an image version.

    Select the My Alibaba Cloud Images tab and Container Registry Personal Edition. From the Select Image Version drop-down list, select go-demo-2.

  2. On the Advanced Settings page, in the Application Monitoring section, enable Application Monitoring.

    Before you enable this feature, you must modify the custom image of the application and manually install the agent during the build process. ARMS provides a free monthly quota of 200 GB for SAE users. Once enabled, SAE provides real-time monitoring of metrics such as request count, error count, average response time, instance GC, and heap memory. It also supports call trace analysis.

  3. Click Create Application.

3.2 Test access

  1. Add a public endpoint to the application. For more information, see Bind an SLB instance to an application and generate a public or private IP address for the application.

    After the configuration is complete, you can view the added public Server Load Balancer (SLB) record in the Public Endpoint section of the Application Access Settings page. The record includes the IP address, port (for example, 2222), and protocol (for example, HTTP).

  2. Copy the public endpoint and open it in a browser to test access.

4. View application monitoring

SAE console

Go to the Basic Information page of your application. In the left navigation pane, click Application Monitoring. On the Application Monitoring page, view the Monitoring Data.

The Application Overview page displays monitoring metrics such as the number of requests, number of errors, average response time, and number of instances, along with their trend charts. This confirms that application monitoring data is collected correctly.

ARMS console

  1. Log on to the ARMS console.

  2. In the left navigation pane, choose Application Monitoring > Application List. In the top menu bar, select the target region.

    The page displays monitoring metrics for your connected application, such as requests per second, error rate, average response time, number of CVEs, Smart Insight, and response time trend. This confirms that application data is collected correctly.

  3. In the search box on the Application List page, search for your application, and then click the application name.

  4. View the monitoring data on the details page.

    eysHShmevA