阅读本文后,我试图清理Spark 3.0.1的指标。这是我的服务监视器。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但是重新标签似乎不起作用。你能在这个问题上帮助我吗?
根据规范,relabelings
必须命名为metricRelabelings
。注意,ServiceMonitors的yaml格式与相应的prometheus配置不使用相同的键名(但它仍然是有效的yaml)。