All Products
Search
Document Center

Application Real-Time Monitoring Service:Monitor a Go application deployed in a DevOps Flow pipeline

Last Updated:Mar 11, 2026

ARMS uses instgo, a compile-time instrumentation tool that wraps your go build command to embed the Application Real-Time Monitoring Service (ARMS) agent into the compiled binary. The instrumented binary reports traces, topology, and SQL analysis data to ARMS at runtime -- no source code changes required. This guide walks you through building an instrumented binary in a DevOps Flow pipeline, deploying it, and verifying that monitoring data appears in the ARMS console.

How it works

Instead of modifying source code, prefix your go build command with instgo to inject the ARMS agent at compile time. The instrumented binary reports data to ARMS automatically at runtime.

Source code  -->  instgo go build  -->  Instrumented binary  -->  Deploy  -->  ARMS console

Prerequisites

Before you begin, make sure that you have:

  • ARMS is activated

  • An ARMS license key, retrieved by calling the DescribeTraceLicenseKey API -- on the API documentation page, click Debug, then click Initiate Call in OpenAPI Explorer to get your key

    OpenAPI Explorer

Step 1: Build the instrumented binary

Download instgo

Download instgo for your OS and architecture from the region where your environment resides. Store it in a directory with write permissions, because instgo downloads dependencies during compilation.

If your build machine can access Object Storage Service (OSS) over the Internet, you can directly use the public endpoint of the China (Hangzhou) region to download instgo.

The download URL follows this pattern:

# Public endpoint
http://arms-apm-<region-id>.oss-<region-id>.aliyuncs.com/instgo/instgo-<os>-<arch>

# VPC endpoint
http://arms-apm-<region-id>.oss-<region-id>-internal.aliyuncs.com/instgo/instgo-<os>-<arch>

Replace the placeholders with actual values:

PlaceholderDescriptionExample
<region-id>Alibaba Cloud region IDcn-hangzhou
<os>Operating systemlinux, darwin, windows
<arch>CPU architectureamd64, arm64
For Windows, the binary filename is instgo-windows-amd64.exe.

Example: Download instgo for Linux AMD64 from the China (Hangzhou) region:

wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/instgo/instgo-linux-amd64" -O instgo

Supported regions and their IDs

RegionRegion ID
China (Hangzhou)cn-hangzhou
China (Shanghai)cn-shanghai
China (Qingdao)cn-qingdao
China (Beijing)cn-beijing
China (Zhangjiakou)cn-zhangjiakou
China (Hohhot)cn-huhehaote
China (Ulanqab)cn-wulanchabu
China (Shenzhen)cn-shenzhen
China (Heyuan)cn-heyuan
China (Guangzhou)cn-guangzhou
China (Chengdu)cn-chengdu
China (Hong Kong)cn-hongkong
Singaporeap-southeast-1
Malaysia (Kuala Lumpur)ap-southeast-3
Indonesia (Jakarta)ap-southeast-5
Japan (Tokyo)ap-northeast-1
Germany (Frankfurt)eu-central-1
UK (London)eu-west-1
US (Virginia)us-east-1
US (Silicon Valley)us-west-1

Supported OS and architecture combinations: Linux (AMD64, ARM64), macOS (AMD64, ARM64), Windows (AMD64).

Grant execute permissions

On Linux or macOS, make the binary executable:

chmod +x instgo

On Windows, no additional permissions are needed.

Configure the license key

Set the license key and region before building. The --dev=false flag configures instgo for production use:

./instgo set --licenseKey=<your-license-key> --regionId=<your-region-id> --dev=false

Replace the placeholders with actual values:

PlaceholderDescriptionHow to get it
<your-license-key>ARMS license keySee Prerequisites.
<your-region-id>Region where your application runsFor example, cn-hangzhou. See the full list in Supported regions above.
Important

If you skip this step, instgo enters Dev mode and installs the latest ARMS agent version. For production deployments, always configure the license key explicitly.

Build with instgo

Prefix your existing go build command with instgo:

./instgo go build -o myapp .

The output binary (myapp in this example) contains the embedded ARMS agent and is ready for deployment.

Build the container image

Use the instrumented binary to build a container image. The following multi-stage Dockerfile integrates instgo into the build:

FROM golang:1.21 AS build
WORKDIR /app

# Copy dependency files first for better layer caching
COPY go.mod go.sum ./
RUN go mod download

# Copy source code
COPY . .

# Download and set up instgo (China (Hangzhou) region, Linux AMD64)
RUN wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/instgo/instgo-linux-amd64" -O instgo \
    && chmod +x instgo \
    && ./instgo set --licenseKey=<your-license-key> --regionId=<your-region-id> --dev=false

# Build with ARMS instrumentation
RUN ./instgo go build -o myapp .

# Runtime stage
FROM debian:bookworm-slim
COPY --from=build /app/myapp /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/myapp"]

Replace <your-license-key> and <your-region-id> with your actual values. Adjust the instgo download URL if your build environment uses a different region or architecture.

Step 2: Deploy the application

Deploy the instrumented application to either a Container Service for Kubernetes (ACK) cluster or an Elastic Compute Service (ECS) instance.

Deploy to an ACK cluster

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. Select the resource group and region of your cluster, then click the cluster name.

  3. In the left-side navigation pane, choose Workloads > Deployments, StatefulSets, or DaemonSets depending on your workload type.

  4. Find the target application. In the Actions column, click the more icon (image) and select Edit YAML. To monitor a new Go application, click Create from YAML on the Deployments page instead.

  5. Add the following labels under spec.template.metadata:

       labels:
         aliyun.com/app-language: golang    # Required. Identifies a Go application.
         armsPilotAutoEnable: 'on'          # Required. Enables ARMS monitoring.
         armsPilotCreateAppName: "<your-deployment-name>"  # Required. Replace with your Deployment name.

    YAML labels configuration example

  6. Save the YAML and wait for the pods to restart.

Deploy to an ECS instance

Before running the instrumented binary, export the following environment variables:

export ARMS_ENABLE=true
export ARMS_APP_NAME=<your-app-name>         # Application name shown in the ARMS console
export ARMS_REGION_ID=<your-region-id>       # Region ID, for example, cn-hangzhou
export ARMS_LICENSE_KEY=<your-license-key>   # License key from Prerequisites

./myapp

The following table describes each variable:

VariableDescriptionExample
ARMS_ENABLEEnables ARMS monitoringtrue
ARMS_APP_NAMEApplication name displayed in the ARMS consolemy-go-service
ARMS_REGION_IDRegion where ARMS collects monitoring datacn-hangzhou
ARMS_LICENSE_KEYARMS license keySee Prerequisites

Verify the result

After about one minute, check the ARMS console to confirm monitoring is active:

  1. Log on to the ARMS console.

  2. In the left-side navigation pane, choose Application Monitoring > Application List.

  3. Confirm that your application appears on the Application List page.

Application List page showing monitored application

After the application appears, click its name to access:

  • Application topology: Visualize dependencies between your services.

  • Traces: Inspect individual request traces to identify latency bottlenecks.

  • SQL analysis: Analyze slow SQL queries and database call patterns.

If your application does not appear after a few minutes, verify that the license key and region ID are correct, and that the application can reach the ARMS endpoint in your region.

What's next