Skip to content

Get Measurement Schema Information



GET /api/v1/metric_info/measurement/schema

Overview

Get the schema information (including fields and tags information) based on the measurement name.

Query Request Parameters

Parameter Name Type Required Description
measurement string Y Measurement name
Allow empty: False

Parameter Supplementary Description

Get the schema information of a measurement, including field list, field type, unit, description, etc.

  • The interface always returns the complete fields.
  • Each field.tags is obtained via get_metric_field_tags_info() and reuses its caching capability.
  • The query time range is uniformly set from 0 to 24 o'clock of the current day in the workspace timezone to improve cache hit rate.
  • Therefore, this interface will always return the complete fields, and field.tags comes directly from the current query result or cached result.

Request Example

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

Response

{
    "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"
}