夜莺发送给Prometheus请求,提示报错out of bounds

Viewed 53

夜莺版本:v6.7.1
Prometheus版本:2.37.6
Categraf版本:v0.3.54

其中夜莺和Prometheus使用单实例部署在同一机器上。
各Categraf主机和夜莺服务器都是通过chronyd与时间服务器同步。夜莺在收到Categraf的指标请求,转写入到Prometheus,提示:2024-05-06 09:33:14.340997 WARNING writer/writer.go:128 push data with remote write:http://127.0.0.1:9090/api/v1/write request got status code: 400, response body: out of bounds。

修改夜莺的配置文件:
[Pushgw]
ForceUseServerTS = true

固然可以解决以上问题,但是这样会导致指标的时间以夜莺收到请求的时间为准了。同时由于Categraf会缓存gauge指标,并且持续发送指标给夜莺,这就导致gauge指标更不精准了。
请问这个有解决办法吗

1 Answers

在夜莺的大佬们的支持下,经过进一步查找分析,发现可以通过升级Prometheus版本来解决这个问题。最后我的解决办法是:
1、升级Prometheus到prometheus-2.45.5版本
2、参考链接中的说明,配置out_of_order_time_window为15天,具体如下:
storage:
tsdb:
out_of_order_time_window: 15d

参考:
1、https://github.com/vectordotdev/vector/issues/5744
2、https://promlabs.com/blog/2022/10/05/whats-new-in-prometheus-2-39/#:~:text=You%20can%20enable%20this%20by%20setting%20the%20out_of_order_time_window,following%20to%20your%20prometheus.yml%3A%20storage%3A%20tsdb%3A%20out_of_order_time_window%3A%201d