Skip to content

Alibaba Cloud API Gateway

Collect monitoring data from Alibaba Cloud API Gateway

Configuration

Install Func

It is recommended to enable TrueWatch Integration - Extensions - DataFlux Func (Automata)

If deploying Func by yourself, refer to Self-deploying Func

Install Script

Note: Please prepare the Alibaba Cloud AK with the required permissions in advance (for simplicity, you can grant the global read-only permission ReadOnlyAccess)

  1. Log in to the Func console, click 【Script Market】, and enter the TrueWatch script market. Search for: integration_alibabacloud_api_gateway

  2. Click 【Install】, then enter the corresponding parameters: Alibaba Cloud AK ID, AK Secret, and account name.

  3. Click 【Deploy Startup Script】, the system will automatically create the Startup script set and configure the corresponding startup scripts.

  4. After enabling, you can see the corresponding automatic trigger configuration in 「Manage / Automatic Trigger Configuration」. Click 【Execute】 to execute it immediately without waiting for the scheduled time. Wait a moment, and you can view the execution task records and corresponding logs.

Verification

  1. In 「Manage / Automatic Trigger Configuration」, confirm whether the corresponding task has the automatic trigger configuration, and check the task records and logs for any anomalies.
  2. In TrueWatch, check if asset information exists in 「Infrastructure / Custom」.
  3. In TrueWatch, check if there is corresponding monitoring data in 「Metrics」.

Metrics

After configuring Alibaba Cloud Cloud Monitor, the default Measurement is as follows. More Metrics can be collected through configuration. Alibaba Cloud Cloud Monitor Metrics Details

API Gateway

MetricName Metric Type MetricDescribe Dimensions Statistics Unit
Latency Instance Dimension Response Time userId,region,apiUid Average ms
SumQPS Instance Dimension Total Requests userId,region,apiUid Count count
TrafficRX Instance Dimension Inbound Traffic userId,region,apiUid Sum B
TrafficTX Instance Dimension Outbound Traffic userId,region,apiUid Sum B
code2XX Instance Dimension 2XX Status Code Count userId,region,apiUid Value count
code429 Instance Dimension 429 Status Code Count userId,region,apiUid Value count
code4XX Instance Dimension 4XX Status Code Count userId,region,apiUid Value count
code5XX Instance Dimension 5XX Status Code Count userId,region,apiUid Value count
error_count_instance apigateway Instance Request Error Count userId,region,apiUid Sum count
instance_lost apigateway Instance Node Loss Ratio userId,region,instanceId Average %
request_count_instance apigateway Instance Total Request Count userId,region,instanceId Sum count

API Group

MetricName Metric Type MetricDescribe Dimensions Statistics Unit
Latency_group apiGroupUid Response Time userId,region,apiGroupUid Average ms
SumQPS_group apiGroupUid Total Requests userId,region,apiGroupUid Count count
TrafficRX_group apiGroupUid Inbound Traffic userId,region,apiGroupUid Sum B
TrafficTX_group apiGroupUid Outbound Traffic userId,region,apiGroupUid Sum B
code2XX_group apiGroupUid 2XX Status Code Count userId,region,apiGroupUid Value count
code429_group apiGroupUid 429 Status Code Count userId,region,apiGroupUid Value count
code4XX_group apiGroupUid 4XX Status Code Count userId,region,apiGroupUid Value count
code5XX_group apiGroupUid 5XX Status Code Count userId,region,apiGroupUid Value count

API Instance

MetricName Metric Type MetricDescribe Dimensions Statistics Unit
Latency_instance Instance Dimension Response Time userId,region,instanceId Average ms
SumQPS_instance Instance Dimension Total Requests userId,region,instanceId Count count
TrafficRX_instance Instance Dimension Inbound Traffic userId,region,instanceId Sum B
TrafficTX_instance Instance Dimension Outbound Traffic userId,region,instanceId Sum B
code2XX_instance Instance Dimension 2XX Status Code Count userId,region,instanceId Value count
code429_instance Instance Dimension 429 Status Code Count userId,region,instanceId Value count
code4XX_instance Instance Dimension 4XX Status Code Count userId,region,instanceId Value count
code5XX_instance Instance Dimension 5XX Status Code Count userId,region,instanceId Value count

Objects

The collected Alibaba Cloud API Gateway object data structure can be seen in 「Infrastructure - Custom」

{
  "measurement": "aliyun_api_gateway",
  "tags": {
    "InstanceSpec"             : "api.s1.small",
    "InstanceName"             : "xxxx-test",
    "InstanceId"               : "i-xxxxx",
    "RegionId"                 : "cn-hangzhou"
  },
  "fields": {
    "ZoneLocalName"                   : "xxxxx",
    "InternetEgressAddress"           : "114.55.1xx.xxx",
    "CreatedTime"                     : "2025/09/01 16:10:09",
    "VpcEgressAddress"                : "100.xxx.xxx.0/xx",
    "InstanceSpecAttributes"          : "xxxxx",
    "InstanceChargeType"              : "PayAsYouGo",
    "VpcSlbIntranetEnable"            : "False",
    "InstanceType"                    : "VPC_SHARED",
    "Status"                          : "RUNNING",
    "ZoneId"                          : "cn-hangzhou",
    "InstanceCidrBlock"               : "172.16.xx.xx/xx",
    "IPV6AclStatus"                   : "off",
    "EgressIpv6Enable"                : "False",
    "MaintainStartTime"               : "18:00Z",
    "MaintainEndTime"                 : "22:00Z"
  }
}

Note: The fields in tags and fields may change with subsequent updates.