0

我在使用Prometheus 客户端模块在 Python 中编写的导出器上工作时遇到了这个问题。我的一些自定义指标以字节为单位测量内存,因此我在导出器中定义了一个指标:

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

(完整代码在这里

该单位明确指定为 Prometheus 客户端可识别的“字节”,因为该指标最终在/metrics端点显示为slurm_nodes_mem_free_bytes. 但是,当我在/api/v1/metadataPrometheus 服务器上检查输出时,该单元为空,即:

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

一开始我以为 Python 客户端有问题,但后来我注意到元数据中的每个指标"unit":""都包含了包附带的 Prometheus 内部指标。这是缺少的功能还是与我的 Prometheus 主机上的设置有关?

我在用:

  • Prometheus 版本 2.19.0,构建日期 20200609-10:29:59;
  • Prometheus Python 客户端版本 0.8.0。
4

0 回答 0