【问题标题】:How can I using prometheus servicemonitor relabeling/metricRelabeling to drop a specific label in a specific metrics?如何使用 prometheus servicemonitor relabeling/metricRelabeling 在特定指标中删除特定标签?
【发布时间】:2022-10-05 14:36:31
【问题描述】:

例如,我有两个具有不同标签的指标

node_metrics_first{foo=\"bar\",AAA=\"aaa\"}
node_metrics_second{BBB=\"bbb\",CCC=\"ccc\"}

如何在 servicemonitor 中使用 relabeling/metricRelabeling drop/labeldrop 来删除 node_metrics_first 中的 foo 标签,这意味着我应该得到结果:

node_metrics_first{AAA=\"aaa\"}
node_metrics_second{BBB=\"bbb\",CCC=\"ccc\"}

    标签: prometheus metrics prometheus-operator servicemonitor


    【解决方案1】:

    来自 Grafana 的大量 blog 关于重新标记的工作原理。在你的情况下:

      - job_name: some_job
        metric_relabel_configs:
          - regex: "foo"
            action: labeldrop
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-30
      • 2022-08-23
      • 1970-01-01
      • 2017-10-22
      • 2018-09-24
      • 1970-01-01
      • 2022-01-16
      • 2015-11-28
      相关资源
      最近更新 更多