【问题标题】:Prometheus relabeling/metricRelabeling to drop and filter by labelsPrometheus relabeling/metricRelabeling 按标签删除和过滤
【发布时间】:2020-06-12 14:57:05
【问题描述】:

我没有运气配置普罗米修斯重新标记。如果我有类似的系列

some_metric{app="foo",baz="true"}
some_metric{app="bar",baz="true"}

如何配置 prometheus(如果重要,目前使用 coreos 运算符),只保留app=foo 并删除标签baz,这样我最终得到:

some_metric{app="foo"}

对于它的价值,这是我目前拥有的,标签按原样显示:

- action: keep
  sourceLabels: ["app"]
  regex: "foo"
- action: labeldrop
  regex: "baz"

【问题讨论】:

    标签: prometheus prometheus-operator


    【解决方案1】:

    这应该可行:

    metric_relabel_configs:
    - action: labeldrop
      regex: baz
    - action: drop
      source_labels: [app]
      regex: bar
    

    【讨论】:

    • 感谢您的回复。 drop 的问题是我必须告诉它要匹配 drop 的所有内容,而我事先并不知道。我确实知道我想要keep,也就是foo
    • 你有 drop 我们不能使用通配符 *?
    猜你喜欢
    • 2022-10-05
    • 2019-12-21
    • 1970-01-01
    • 2021-10-12
    • 2022-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多