Help Center/ GaussDB/ API Reference/ APIs (Recommended)/ Metric Management/ Querying Metrics of a Specific DB Instance
Updated on 2025-10-20 GMT+08:00

Querying Metrics of a Specific DB Instance

Function

This API is used to query metrics of a specified DB instance. Before calling this API:

Debugging

You can debug this API in API Explorer.

URI

GET /v3/{project_id}/instances/{instance_id}/metric-data

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Definition

Project ID of a tenant in a region.

To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are allowed.

Default Value

N/A

instance_id

Yes

Definition

Instance ID, which uniquely identifies an instance.

Constraints

N/A

Range

The value can contain 36 characters. Only letters and digits are allowed.

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

start_time

Yes

String

Definition

Start time in timestamp format, for example, 1756971683303.

Constraints

N/A

Range

N/A

Default Value

N/A

end_time

Yes

String

Definition

End time in timestamp format, for example, 1756975283303.

Constraints

N/A

Range

N/A

Default Value

N/A

metric

Yes

Array

Definition

Metric ID, which can be obtained by calling the "Querying Metrics of a Metric Group" API. For example, to query the CPU usage, set this parameter value to rds001_cpu_util.

Constraints

N/A

node_id

Yes

Array

Definition

Node ID.

Constraints

N/A

component_id

No

Array

Definition

Component ID, for example, dn_6001.

Constraints

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token.

You can obtain the token by calling the IAM API used to obtain a user token.

After the request is processed, the value of X-Subject-Token in the message header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Language.

Constraints

N/A

Range

  • zh-cn
  • en-us

Default Value

en-us

Response Parameters

Table 4 Response body parameters

Parameter

Type

Description

instance_id

String

Definition

Instance ID.

Range

The value can contain 36 characters. Only letters and digits are allowed.

metrics

Array of MetricDataResult objects

Definition

Metric data set. For details, see Table 5.

Table 5 MetricDataResult field data structure description

Parameter

Type

Description

metric

String

Definition

Metric ID.

Range

N/A

type

String

Definition

Metric type.

Range

  • INSTANCE: instance-level.
  • NODE: node-level.
  • COMPONENT: component-level.

unit

String

Definition

Metric unit.

Range

N/A

datapoints

Array of DatapointResult objects

Definition

Metric dimension and value. For details, see Table 6.

timestamps

Array of Strings

Definition

Timestamp.

Table 6 DatapointResult field data structure description

Parameter

Type

Description

datapoint_name

String

Definition

Metric item. It can be instance ID, node name, or component name.

Range

N/A

datapoint_values

Array of Strings

Definition

Metric value set.

Example Request

https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/instances/e73893ef73754465a8bd2e0857bbf13ein14/metric-data?start_time=1699260798398&end_time=1699319598743&metric=rds001_cpu_util,rds002_mem_util&node_id=6b7616dfb1c14721b1a11dd5654c1515no14,ef3af6ce4d064eb28d38eff00ff96dfano14&component_id=dn_6001,dn_6002

Example Response

{ 
  "instance_id" : "f7fb5cda6f134275830e4e3af80788aein14", 
  "metrics" : [ { 
    "metric" : "rds036_deadlocks", 
    "type" : "INSTANCE", 
    "unit" : "Count", 
    "datapoints" : [ { 
      "datapoint_name" : "f7fb5cda6f134275830e4e3af80788aein14", 
      "datapoint_values" : [ 0, 1 ] 
    } ], 
    "timestamps" : [ 1699495140000, 1699495200000 ] 
  }, { 
    "metric" : "rds001_cpu_util", 
    "type" : "NODE", 
    "unit" : "%", 
    "datapoints" : [ { 
      "datapoint_name" : "node_01", 
      "datapoint_values" : [ 24.29, 37.81 ] 
    }, { 
      "datapoint_name" : "node_02", 
      "datapoint_values" : [ 18.8, 17.69 ] 
    } ], 
    "timestamps" : [ 1699495140000, 1699495200000 ] 
  }, { 
    "metric" : "rds008_disk_used_size", 
    "type" : "COMPONENT", 
    "unit" : "GB", 
    "datapoints" : [ { 
      "datapoint_name" : "dn_6001", 
      "datapoint_values" : [ 1.61, 1.62 ] 
    }, { 
      "datapoint_name" : "dn_6002", 
      "datapoint_values" : [ 1.64, 1.66 ] 
    } ], 
    "timestamps" : [ 1699495140000, 1699495200000 ] 
  } ] 
}

Status Codes

Error Codes

For details, see Error Codes.