如何处理 "prometheus" 和 "prometheus_replica" 标签?
How to deal with "prometheus" and "prometheus_replica" labels?
在 prometheus 的分层联合设置中,使用指标的拉模型,我在捕获的指标中看到 "prometheus" 和 "prometheus_replica" 标签。系统正在监控 Kubernetes 的 StatefulSet 部署。
在查询或提醒时,我看到由于这些标签而包含重复数据,即我看到带有这些标签和没有这些标签的指标。有效地导致错误的计数和警报。
我看到 "prometheus" 和 "prometheus_replica" 标签用于从联合端点提取指标的普罗米修斯查询中。
我在每个 kube 集群上使用 ServiceMonitor 和 Prometheus operator。所有指标都联合到一个不同的普罗米修斯,其中出现了这个问题。
是否有关于如何生成这些标签的文档?这些指标是被重复处理还是被忽略?
我终于找到了这些来自普罗米修斯算子的标签。添加它是为了满足任何文档中未写入的要求。我看到它在 0.17 版本中不起作用。它适用于 0.23 版本的运算符。
我也 运行 解决了这个问题,只是根据此处的文档 https://github.com/prometheus-operator/prometheus-operator/blob/ca400fdc3edd0af0df896a338eca270e115b74d7/Documentation/api.md#prometheusspec 为收到此评论的任何人添加影响此问题的配置选项。
link 到这里的代码 https://github.com/prometheus-operator/prometheus-operator/blob/ca400fdc3edd0af0df896a338eca270e115b74d7/pkg/prometheus/promcfg.go#L95-L132
replicaExternalLabelName: Name of Prometheus external label used to denote replica name. Defaults to the value of prometheus_replica. External label will not be added when value is set to empty string ("").
prometheusExternalLabelName: Name of Prometheus external label used to denote Prometheus instance name. Defaults to the value of prometheus. External label will not be added when value is set to empty string ("").
因此,如果您想删除这些重复项,只需在集群的 Prometheus 自定义资源中将这些选项设置为空字符串即可。
在 prometheus 的分层联合设置中,使用指标的拉模型,我在捕获的指标中看到 "prometheus" 和 "prometheus_replica" 标签。系统正在监控 Kubernetes 的 StatefulSet 部署。
在查询或提醒时,我看到由于这些标签而包含重复数据,即我看到带有这些标签和没有这些标签的指标。有效地导致错误的计数和警报。
我看到 "prometheus" 和 "prometheus_replica" 标签用于从联合端点提取指标的普罗米修斯查询中。
我在每个 kube 集群上使用 ServiceMonitor 和 Prometheus operator。所有指标都联合到一个不同的普罗米修斯,其中出现了这个问题。
是否有关于如何生成这些标签的文档?这些指标是被重复处理还是被忽略?
我终于找到了这些来自普罗米修斯算子的标签。添加它是为了满足任何文档中未写入的要求。我看到它在 0.17 版本中不起作用。它适用于 0.23 版本的运算符。
我也 运行 解决了这个问题,只是根据此处的文档 https://github.com/prometheus-operator/prometheus-operator/blob/ca400fdc3edd0af0df896a338eca270e115b74d7/Documentation/api.md#prometheusspec 为收到此评论的任何人添加影响此问题的配置选项。 link 到这里的代码 https://github.com/prometheus-operator/prometheus-operator/blob/ca400fdc3edd0af0df896a338eca270e115b74d7/pkg/prometheus/promcfg.go#L95-L132
replicaExternalLabelName: Name of Prometheus external label used to denote replica name. Defaults to the value of prometheus_replica. External label will not be added when value is set to empty string ("").
prometheusExternalLabelName: Name of Prometheus external label used to denote Prometheus instance name. Defaults to the value of prometheus. External label will not be added when value is set to empty string ("").
因此,如果您想删除这些重复项,只需在集群的 Prometheus 自定义资源中将这些选项设置为空字符串即可。