kubernetes 普罗米修斯号操纵舵图:度量重新标记

xqkwcwgp  于 2022-11-02  发布在  Kubernetes
关注(0)|答案(1)|浏览(158)

在我的v33 Helm图表中,我需要删除ID标签,以减少TSDB的大小。根据article,这可以通过Metric Relabelings来完成。因此,在值文件的所有相关部分中,我有以下内容:

metricRelabelings:
  - sourceLabels: [id]
    action: "drop"

在生成的Prometheus配置中,我可以在端口9090上的Web GUI中看到这一点(在所有相关部分中也是如此),如下所示:

metric_relabel_configs:
  - source_labels: [id]
    separator: ;
    regex: (.*)
    replacement: $1
    action: drop

但是,在GUI的TSDB状态中,“id”标签仍然存在,其基数与尝试删除之前相同。
我错过了什么?

x3naxklr

x3naxklr1#

我在Prometheus运算符图表中用这个正则表达式来表示在values.yaml中有cpecific标签的drop度量。

kube-state-metrics:
  namespaceOverride: ""
  rbac:
    create: true
  releaseLabel: true
  prometheus:
    monitor:
      enabled: true

      ## Scrape interval. If not set, the Prometheus default scrape interval is used.
      ##
      interval: ""

      ## Scrape Timeout. If not set, the Prometheus default scrape timeout is used.
      ##
      scrapeTimeout: ""

      ## proxyUrl: URL of a proxy that should be used for scraping.
      ##
      proxyUrl: ""

      # Keep labels from scraped data, overriding server-side labels
      ##
      honorLabels: true

      ## MetricRelabelConfigs to apply to samples after scraping, but before ingestion.
      ## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
      ##
      metricRelabelings:
      - action: drop
        regex: '(default|test2|test1)'
        sourceLabels: [namespace]

相关问题