prometheusでメトリック名の前に名前空間を追加するにはどうすればよいですか?
Aug 18 2020
prometheus.ymlに静的設定があります
- job_name: 'myjob'
static_configs:
- targets: ['monitoring.api.endpoint.net']
そして、たとえばcpu_usage
、disk_write_ops
などのさまざまなメトリックcompute_cpu_usage
を受け取ります。ラベル変更ツールのように、それらすべてを名前空間に入れることは可能ですか?
回答
1 VasiliyShakhunov Aug 18 2020 at 20:11
この解決策を見つけました:
static_configs:
- targets: ['monitoring.api.endpoint.net']
metric_relabel_configs:
- source_labels: [__name__]
regex: '(.*)'
replacement: 'compute_${1}'
target_label: __name__