Prometheus Metrics API

Function Description

Provides the Metrics API for Prometheus to call and integrate.

URL

GET http://ip:port/metrics

For security purposes, NPU Exporter enables the container-level port (8082 by default) by default. The request IP address is the IP address of the Kubernetes container. If the Kubernetes network plugin is Calico, the network policy is set to one that allows the access of the application with the label app=prometheus.

Request Parameters

None

Response Description

Data is returned in the dedicated format of Prometheus. The following information is for reference only. For details about the data, see the following content or Data Description. You can ignore the data provided by Prometheus. Data supported by a product may vary.

...

# HELP machine_npu_nums Amount of npu installed on the machine.
# TYPE machine_npu_nums gauge
machine_npu_nums 8
# HELP npu_chip_info_aicore_current_freq the npu ai core current frequency, unit is 'MHz'
# TYPE npu_chip_info_aicore_current_freq gauge
npu_chip_info_aicore_current_freq{container_name="",id="0",model_name="910A-Ascend-V1",namespace="",pcie_bus_info="0000:61:00.0",pod_name="",vdie_id="185011D4-21104518-A0C4ED94-14CC040A-56102003"} 1000 1723621883587
npu_chip_info_aicore_current_freq{container_name="",id="1",model_name="910A-Ascend-V1",namespace="",pcie_bus_info="0000:DB:00.0",pod_name="",vdie_id="185011D4-21E04718-93B2ED94-14CC040A-BF102003"} 1000 1723621883932
npu_chip_info_aicore_current_freq{container_name="",id="2",model_name="910A-Ascend-V1",namespace="",pcie_bus_info="0000:B2:00.0",pod_name="",vdie_id="185011D4-20C02418-59D4ED94-14CC040A-F9102003"} 1000 1723621884277
npu_chip_info_aicore_current_freq{container_name="",id="3",model_name="910A-Ascend-V1",namespace="",pcie_bus_info="0000:3E:00.0",pod_name="",vdie_id="185011D4-21502C18-0464ED94-14CC040A-6E102003"} 1000 1723621884682
npu_chip_info_aicore_current_freq{container_name="",id="4",model_name="910A-Ascend-V1",namespace="",pcie_bus_info="0000:60:00.0",pod_name="",vdie_id="185011D4-21A02418-64946D94-14CC040A-F8102003"} 1000 1723621885026
npu_chip_info_aicore_current_freq{container_name="",id="5",model_name="910A-Ascend-V1",namespace="",pcie_bus_info="0000:DA:00.0",pod_name="",vdie_id="185011DC-21F02B18-C4B66D94-14CC040A-57102003"} 1000 1723621885385
npu_chip_info_aicore_current_freq{container_name="",id="6",model_name="910A-Ascend-V1",namespace="",pcie_bus_info="0000:B1:00.0",pod_name="",vdie_id="185011D4-20602118-14646D94-14CC040A-8A102003"} 1000 1723621885784
npu_chip_info_aicore_current_freq{container_name="",id="7",model_name="910A-Ascend-V1",namespace="",pcie_bus_info="0000:3D:00.0",pod_name="",vdie_id="185011D4-21504C18-10656D94-14CC040A-6B102003"} 1000 1723621886131
# HELP npu_chip_info_bandwidth_rx the npu interface receive speed, unit is 'MB/s'
# TYPE npu_chip_info_bandwidth_rx gauge
npu_chip_info_bandwidth_rx{container_name="",id="0",model_name="910A-Ascend-V1",namespace="",pcie_bus_info="0000:61:00.0",pod_name="",vdie_id="185011D4-21104518-A0C4ED94-14CC040A-56102003"} 0 1723621883587
...

This API can be used to query both the default and custom metrics groups. Custom Metric Development describes how to customize a metrics group, and the default metrics group contains the following parts. The collection and reporting of a metrics group are governed by its corresponding configuration parameter. When enabled, the metrics group is collected and reported; when disabled, it is neither collected nor reported.

For details, see Label Description.

  • If the process is running on a host and the pod does not use NPUs, the values of pod_name, container_name, and namespace are empty.
  • NPU Exporter obtains data information by calling the underlying HDK APIs. For more details, see HDK APIs to Be Called.
  • NPU Exporter does not report data if it does not support the listed products or HDK APIs fail to be called when a data record is queried.

HDK APIs to Be Called

NPU Exporter obtains data information by calling the underlying HDK APIs. For details about HDK APIs called to obtain the above data, HDK APIs Called by NPU Exporter. To search for the required HDK APIs, perform the following steps:

  1. Visit Ascend Computing Documentation and select a product name to go to the document page. For example, if you are a user of Atlas 800I A2 inference servers, click Atlas 800I A2.
  2. In the navigation pane on the left, click Developer Documents.
  3. In the search box on the home page of the document, search for an API name or keyword to view the API information.

Status Codes

Table 12 Status codes

Status Code

Description

200

Normal

307

Temporary redirection

500

Internal server error