Custom Metrics File

Field Description

Table 1 describes the fields in the custom metrics file. Metrics can be customized through this file. For details, see Custom Metric Development.

Table 1 Fields in the custom metrics file

Field

Type

Description

version

String

Fixed value: 1.0.

name

String

Metric name. The value can contain a maximum of 128 characters and corresponds to the data name of the Prometheus API.

desc

String

Metric details. The value can contain a maximum of 1024 characters.

timestamp

timestamp

Timestamp when a metric is updated, in μs.

data_list

list

Array. The length cannot exceed 128 characters.

-value

float

Metric value.

-label

JSON

Metric label. The key and value of the JSON must be strings. The number of sub-elements in the JSON cannot exceed 10.

Restrictions

  • Symbolic links are not supported.
  • Directories cannot be specified.
  • Only one JSON file can be specified. If multiple JSON files are specified, only the first one is read.
  • The field format in the file must meet the requirements listed in Table 1. If the format is incorrect, file-based custom metric collection will be disabled.
  • If the specified custom metric file is missing or empty, file-based metric collection will be disabled after 1 minute unless the file becomes valid.
  • When the label of a metric is automatically obtained, the first data record in data_list is used.
  • The custom metric file must be owned by the root group, be readable, and not be executable.
  • During program running, name, desc, version, and label of the file cannot be modified.
  • Custom metrics files can be reported only in Prometheus mode.
  • The size of a custom metric file cannot exceed 100 KB.

Data Example

{
  "version": "1.0",
  "name": "hccs_bandwidth",
  "desc": "hccs bandwidth info, unit is 'MB/s'.",
  "timestamp": 1766456419845127,
  "data_list": [
    {
      "value": 190.02,
      "label": {
        "numa": "2",
        "device": "hisi_sicl10_pa0",
        "link": "0",
        "direction": "in",
        "path": "P0->P1"
      }
    },
    {
      "value": 143.09,
      "label": {
        "numa": "2",
        "device": "hisi_sicl10_pa0",
        "link": "1",
        "direction": "in",
        "path": "P2->P1"
      }
    }
  ]
}