普罗米修斯元数据中不存在公制单位

2024-05-23 13:36:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我在使用Prometheus client module用Python编写exporter时遇到了这个问题。我的一些自定义指标以字节为单位度量内存,因此我在导出器中定义了一个指标:

NODES_MEM_FREE = GaugeMetricFamily('slurm_nodes_mem_free', 'Amounts of free memory allocated on nodes in the cluster ...', labels=self.labels, unit='bytes')

(完整代码here

单位被显式指定为“字节”,由Prometheus客户端识别,因为度量最终在/metrics端点显示为slurm_nodes_mem_free_bytes。但是,当我在Prometheus服务器上检查/api/v1/metadata处的输出时,该单元为空,即:

"slurm_nodes_mem_free_bytes":[{"type":"gauge","help":"Amounts of free memory allocated on nodes in the cluster grouped by cluster, partition","unit":""}]

首先,我认为Python客户机有问题,但随后我注意到元数据中的每个度量都包含包中附带的Prometheus内部度量。这是缺少的功能还是我的普罗米修斯主机上的设置有问题

我正在使用:

  • 普罗米修斯版本2.19.0,建造日期20200609-10:29:59
  • Prometheus Python客户端版本0.8.0

Tags: offree字节bytes度量单位指标mem