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/metadata
、Prometheus サーバーで出力を確認すると、ユニットは空です。つまり、次のようになります。
"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。