วิธีต่อท้ายเนมสเปซก่อนชื่อเมตริกในโพรมีธีอุส?

Aug 18 2020

ฉันมีการกำหนดค่าคงที่ใน prometheus.yml

  - job_name: 'myjob'
    static_configs:
      - targets: ['monitoring.api.endpoint.net']

และฉันได้รับตัวชี้วัดต่างๆเช่นcpu_usage, disk_write_opsฯลฯ มันเป็นไปได้ที่จะนำพวกเขาทั้งหมดลง namespace ชอบ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__