Skip to content

Get Metric and Tag Information



GET /api/v1/metric_info/get

Overview

Read the metadata of the specified measurement and the descriptions of the Tags that have been queried.

Before You Begin and Usage Steps

  1. Get the exact name from content.data[].name in the Measurement List and pass it to the Query parameter metric.
  2. Read fields and descriptions from content.metric_fields_info[], and Tag descriptions from content.tags_info[]; set Accept-Language when localization is required.

You can first get the measurement name, then read field descriptions, units, and existing Tag descriptions. When no matching field metadata or Tag exists, the corresponding array is empty.

Field queries are based on the current day's data in the current workspace; Tag associations are cached for about 1 hour, and partial results already obtained may be retained when a Tag query fails. Empty tags alone cannot prove that no tags exist, nor are they a complete enumeration of all historical tags.

Request Headers

Parameter Type Required Description
Accept-Language string Determines the language of localizable descriptions for fields and Tags.
Example: zh
How to obtain or specify: Enter the language in which descriptions should be returned, for example zh.
DF-API-KEY string Y AK identifier, AK uuid
Example: <DF-API-KEY>
How to obtain or specify: Create or obtain a Key with permissions for this API in API Key Management of the target workspace.

Query Request Parameters

Parameter Type Required Description
metric string Y The exact name of the measurement, for example cpu.
Allowed null: False
Allowed empty string: False
Example: cpu
How to obtain or specify: Take the value from content.data[].name in the Get Measurement List response.

Additional Parameter Notes

Use GET to read data of the workspace to which the current API Key belongs.

Request Example

curl --get -H "DF-API-KEY: <DF-API-KEY>" \
  "https://openapi.guance.com/api/v1/metric_info/get" \
  --data-urlencode "metric=cpu"

Response

HTTP 200, application/json.

Field Type Description
content.metric_fields_info array<object> Result list. Empty array when there are no matching results.
content.metric_fields_info[].field string Metric field name.
content.metric_fields_info[].type string Source of the field metadata: inner for built-in, custom for custom.
content.metric_fields_info[].data_type string or null Data type of the field.
content.metric_fields_info[].unit string Metric unit; may be empty.
content.metric_fields_info[].desc string Description of the metric field.
content.metric_fields_info[].tags array<string> Array of Tag names associated with the field; may be affected by cache or partial Tag query failures, and an empty array alone cannot prove that there are no associated tags.
content.metric_fields_info[].origin_field string Original field name; returned for some configurations.
content.tags_info array<object> Result list. Empty array when there are no matching results.
content.tags_info[].tag_key string Tag name.
content.tags_info[].tag_desc string Tag description; may be empty.
content.declaration object or null Workspace-level common declaration attached to a non-empty content; may be null or an empty object when not configured; not added when the content object is empty.
{
  "code": 200,
  "content": {
    "metric_fields_info": [
      {
        "field": "usage_idle",
        "type": "inner",
        "data_type": "float",
        "unit": "percent",
        "desc": "Idle percentage",
        "tags": [
          "host"
        ]
      }
    ],
    "tags_info": [
      {
        "tag_key": "host",
        "tag_desc": "Host name"
      }
    ],
    "declaration": null
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed A required Query parameter is missing, or an undeclared Query parameter is passed Request field validation failed; the message indicates the field or rule. Check the parameter table and the example.
403 ft.ForbiddenQuery The current credential is not authorized to query the data corresponding to the request Insufficient query permission. Check the API Key query permission and the authorization scope of the target data.
503 ft.QueryServiceUnavailable The dependent query service is temporarily unavailable The query service is temporarily unavailable; retry later. Check content.retryable; for transient errors, retry after a delay.

Feedback

Is this page helpful?