Query calculation instance indicators

Read usage metrics for a compute instance.

HTTP
GET $CLOUDSIGMA_API_BASE/compute-resources/{resource_id}/metrics

Before you call this API

Configure the regional API endpoint and authentication, and select the target workspace.

First Query the computing instance details] and confirm the instance you want to query.

Set the operation-specific values used in the request:

  • $RESOURCE_ID: The computing instance ID to be queried.

The indicator items in data.breakdown will evolve with the service implementation, and the caller should be able to accept new fields.

Request

Shell
curl "$CLOUDSIGMA_API_BASE/compute-resources/$RESOURCE_ID/metrics" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Path parameters

Parameter

Type

Required

Description

resource_id

string

Yes

Compute instance ID.

Successful response

Returns 200 on success, and the business data is located at data. The requested resource ID is used to identify the indicator ownership; the current interface can return empty indicator objects.

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "compute_resource_id": "cr-001",
    "total_credit": 0,
    "breakdown": {}
  }
}

The response fields are as follows.

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

object

Indicator object.

data.compute_resource_id

string

The calculation instance ID to which the indicator belongs.

data.total_credit

integer

The total Credit value returned by the server.

data.breakdown

object

Indicator details; the keys and values are provided by the server and may be added.

Error response

JSON
{
  "code": "GET_METRICS_FAILED",
  "msg": "服务端错误",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

401

—

Missing or invalid access credentials.

Check the regional endpoint, API key, and workspace ID.

403

ErrForbidden

The current identity does not have permission to read instance metrics.

Use valid credentials, or contact your administrator for authorization.

500

GET_METRICS_FAILED

The service cannot read the indicator.

Record the request time and error message and try again.

Follow-up operations

Query calculation instance details to associate indicators with the current status of the instance.

Last updated on