exportprometheusprometheus-pushgateway

How to ensure that the data pulled by Prometheus is up-to-date and does not include old data before the pull interval


The Prometheus interval pulls data from the pushgateway. The pushgateway uses the “-persistence.file string” data persistence parameter configuration. The client sends data to the pushgateway in real time.

If Prometheus pulls data within the time interval. Pushgateway did not receive data from the client. What happens when Prometheus pulls data from the pushgateway interval?

  1. Will Prometheus pull old data outside the time interval, and then take the pull time as the time of the old data?
  2. Prometheus will judge according to the pull time interval, pushgateway no new data during this period, and then pull the data is empty?
  3. Still have other results

Solution

  • The Pushgateway will always serve the most recent push to it (if any) for a group. If you care about only getting very recent data then the pushgateway is not right for your use case (see https://prometheus.io/docs/practices/pushing/).

    What you probably want to do is use direct instrumentation, and have Prometheus scrape your applications directly.