4

I'm trying to use Prometheus and VictoriaMetrics to collect data and when configuring my server prometheus.yml there is one line:

scrape_interval: 15s  # How frequently to scrape targets by default.

Does this mean my search result might be delayed by 15s?

valyala
  • 11,669
  • 1
  • 59
  • 62
eason wu
  • 43
  • 1
  • 5

1 Answers1

3

Yes, this means that at worst, your metrics will arrive 15 seconds later. You can configure it to be faster.

<duration>: a duration matching the regular expression [0-9]+(ms|[smhdwy])

The above is from the Prometheus docs at: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#duration

Typically, think of it as Prometheus taking snapshots of what your (continuous) metrics look like (CPU used, no. of threads running etc.) instead of thinking of Prometheus as a place to collect discrete events.

When you are thinking of how long your alert will take to fire, or for the data to be visible, the scrape interval is a factor to keep in mind.

In the context of alerting, a good resource is this article: https://pracucci.com/prometheus-understanding-the-delays-on-alerting.html

It basically says that if your scrape interval is x time unit, and you only fire an alert if an expression is true for y time unit, then the delay could at worst be (x + y) time units.

Saurabh Maurya
  • 870
  • 7
  • 12