首页 > 解决方案 > 如何保证 Prometheus 拉取的数据是最新的,不包含拉取区间之前的旧数据

问题描述

Prometheus 区间从 pushgateway 中拉取数据。pushgateway 使用“-persistence.file string”数据持久化参数配置。客户端实时向推送网关发送数据。

如果 Prometheus 在时间间隔内拉取数据。Pushgateway 没有收到来自客户端的数据。当 Prometheus 从 pushgateway 区间拉取数据时会发生什么?

  1. Prometheus会在时间间隔之外拉取旧数据,然后把拉取时间作为旧数据的时间吗?
  2. prometheus会根据pull时间间隔判断,pushgateway在此期间没有新数据,然后pull数据为空?
  3. 还有其他结果

标签: exportprometheusprometheus-pushgateway

解决方案


Pushgateway 将始终为组提供最近的推送(如果有)。如果您只关心获取最近的数据,那么 pushgateway 不适合您的用例(请参阅https://prometheus.io/docs/practices/pushing/)。

您可能想要做的是使用直接检测,并让 Prometheus 直接抓取您的应用程序。


推荐阅读