跳转至

获取指标集 Schema 信息



GET /api/v1/metric_info/measurement/schema

概述

根据指标集名获取其 Schema 信息(包含 fields 和 tags 信息)

Query 请求参数

参数名 类型 必选 说明
measurement string Y 指标集名称
允许为空: False

参数补充说明

获取指标集的 schema 信息,包含字段列表、字段类型、单位、描述等信息。

  • 接口始终返回完整的 fields
  • 每个 field.tags 通过 get_metric_field_tags_info() 获取,并复用其缓存能力
  • 查询时间范围统一为工作空间时区当天 0 点到 24 点,以提升缓存命中率
  • 因此该接口会始终返回完整 fields,且 field.tags 直接来自当前查询结果或缓存结果

请求例子

curl -k 'https://openapi.guance.com/api/v1/metric_info/measurement/schema?measurement=cpu' \
-H 'DF-API-KEY: <DF-API-KEY>' \
--compressed

响应

{
    "code": 200,
    "content": {
        "declaration": {
            "business": "",
            "organization": "663dbba102482200070bbb02"
        },
        "fields": [
            {
                "description": "",
                "name": "load5s",
                "tags": [
                    {
                        "description": "",
                        "name": "region"
                    },
                    {
                        "description": "",
                        "name": "cpu"
                    },
                    {
                        "description": "",
                        "name": "host"
                    },
                    {
                        "description": "",
                        "name": "zone_id"
                    }
                ],
                "type": "gauge",
                "unit": "",
                "value_type": "float"
            },
            {
                "description": "",
                "name": "usage_guest",
                "tags": [
                    {
                        "description": "",
                        "name": "region"
                    },
                    {
                        "description": "",
                        "name": "cpu"
                    },
                    {
                        "description": "",
                        "name": "host"
                    },
                    {
                        "description": "",
                        "name": "zone_id"
                    }
                ],
                "type": "gauge",
                "unit": "",
                "value_type": "float"
            }
        ],
        "measurement": "cpu"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "69ba6c7800000000d2108e22fe3fb1dc"
} 

文档评价

文档内容是否对您有帮助? ×