如何使用联邦收集普罗米修斯';来自多个Prometheus实例的度量(每个实例使用的是“localhost:9090”)
我们有多个在数据中心运行的Prometheus实例(我将它们称为DC Prometheus实例),还有一个额外的Prometheus实例(在下面的文本中称之为“main”),其中我们使用联合功能从DC Prometheus实例收集度量 主Prometheus正在从自身以及DC Prometheus实例(每个实例都从localhost:9090)中刮取{job='Prometheus'}值 问题是普罗米修斯少校抱怨样品出现问题: 摄取无序样本时出现警告[1585]错误numDropped=369 source=target。go:475 target=dc1普罗米修斯:443 我发现这是因为在'match[]参数中包含了如何使用联邦收集普罗米修斯';来自多个Prometheus实例的度量(每个实例使用的是“localhost:9090”),prometheus,Prometheus,我们有多个在数据中心运行的Prometheus实例(我将它们称为DC Prometheus实例),还有一个额外的Prometheus实例(在下面的文本中称之为“main”),其中我们使用联合功能从DC Prometheus实例收集度量 主Prometheus正在从自身以及DC Prometheus实例(每个实例都从localhost:9090)中刮取{job='Prometheus'}值 问题是普罗米修斯少校抱怨样品出现问题: 摄取无序样本时出现警告[1585]错误numDropped=369
{job=“prometheus”}
我试图通过重新贴标签来解决这个问题,但当我尝试使用单个DC Prometheus和持续替换时,我无法让它工作(我仍然出现无序样本错误),我甚至不知道在使用多个目标时使用什么作为替换
- job_name: 'federate'
scrape_interval: 15s
honor_labels: true
metrics_path: '/prometheus/federate'
scheme: 'https'
params:
'match[]':
- '{job="some-jobs-here..."}'
- '{job="prometheus"}'
relabel_configs:
- source_labels: ['instance']
target_label: 'instance'
regex: 'localhost:9090'
replacement: '??' # I've tried with 'dc1-prometheus:9090' and single target only.. no luck
target_groups:
- targets:
- 'dc1-prometheus'
- 'dc2-prometheus'
- 'dc3-prometheus'
我的问题是如何使用relabel_configs来消除无序错误。我到处都在使用Prometheus 0.17。这里需要做的是在每个数据中心Prometheus服务器上指定唯一的
外部标签。这将导致他们在/federate
端点上添加这些标签,并防止您遇到的冲突时间序列
我关于联合普罗米修斯的博文有这样一个例子:
(我应该补充一点,relabel\u configs
在这里对您没有帮助,因为这只会更改目标标签。metric\u relabel\u configs
会更改从刮擦中恢复的内容。请参阅)非常感谢。这看起来很有前途,我要试试看!