【问题标题】:Renaming metrics in service monitor在服务监视器中重命名指标
【发布时间】:2021-01-23 17:24:47
【问题描述】:

阅读this 文章后,我正在尝试清理从 Spark 3.0.1 出来的指标。这是我的 servicemonitor.yml 文件:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app: spark3
    release:  prometheus
  name: spark3-servicemonitor
spec:
  endpoints:
  - interval: 5s
    port: spark-ui
    path: /metrics/prometheus
    relabelings:
    # Rename metrics
      - sourceLabels: [__name__]
        targetLabel: __name__
        regex: 'metrics_spark_driver_.+_StreamingMetrics_([a-zA-Z_]{1,})_Value'
        replacement: 'spark_driver_$1'
  namespaceSelector:
    matchNames:
    - default
  selector:
    matchLabels:
      spark-version: "3"

我期待以下转变: metrics_spark_driver_whateverappid_StreamingMetrics_streaming_lastCompletedBatch_totalDelay_Value -> spark_driver_streaming_lastCompletedBatch_totalDelay 但是重新标记似乎不起作用。你能帮我解决这个问题吗?

【问题讨论】:

    标签: apache-spark kubernetes monitoring prometheus


    【解决方案1】:

    relabelings 必须根据spec 命名为metricRelabelings。请注意,ServiceMonitors 的 yaml 格式并没有使用与对应的 prometheus config 相同的键名(但它仍然是有效的 yaml)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-18
      • 1970-01-01
      • 2019-03-10
      • 2010-10-28
      • 2022-07-19
      • 1970-01-01
      • 2014-03-25
      相关资源
      最近更新 更多