All Products
Search
Document Center

Serverless App Engine:Install the agent for a Golang application

Last Updated:Oct 21, 2025

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

Limitations

This feature applies only to Go applications that are deployed using images.

Procedure overview

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

  2. 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.

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

  4. 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.

  1. 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 instgo

    In 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.

    Note

    The 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.

  2. Add execute permission to the binary file.

    RUN chmod +x instgo
  3. Obtain the LicenseKey by calling an OpenAPI. For more information, see DescribeTraceLicenseKey - List LicenseKeys.

  4. Replace the go build command with ./instgo build to 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 --dev to enable the development compile mode. In this mode, you do not need to pass a LicenseKey.

    Note

    If 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} ...
    • The following table describes the common commands and flags for instgo.

      Command

      Flag

      Parameter type

      Description

      Required

      build (compile)

      --licenseKey, -l

      string

      Specifies the LicenseKey for ARMS.

      Yes (Optional in dev mode)

      --dev

      -

      Specifies the development compile mode. In this mode, you can compile without specifying a LicenseKey. This is used to test basic availability.

      Important

      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 of the OSS where the agent package dependencies are located. Default value: cn-hangzhou.

      No

      --timeout, -t

      int

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

      No

      --verbose, -v

      -

      If enabled, detailed compile logs are printed.

      No

      --vpc

      -

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

      No

      clean

      (clean up artifacts)

      -

      -

      -

      -

      update (update)

      --licenseKey, -l

      string

      Specifies the LicenseKey for ARMS.

      Yes

      --cacheDir

      string

      Specifies the agent cache directory.

      No

      --regionId, -r

      string

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

      No

      --timeout, -t

      int

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

      No

      --vpc

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

      No

      version

      (output version number)

      -

      -

      -

      -

    • During the first compilation, the agent is downloaded to the /opt directory by default. Use the --cacheDir flag 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

  1. In the Set Image panel, set Technology Stack to Go, and then select an image version.

    Zjyqn9Csms

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

    qVjKh7KK96

  3. Click Create Application.

3.2 Test access

  1. 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.

    oG7Zx8icdv

  2. 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.

ZzhYn22HbM

View data in the ARMS console

  1. Log on to the ARMS console.

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

    nsyE8WuFPg

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

    5RZ1EeP2Mx

  4. View the monitoring data on the monitoring details page.

    eysHShmevA