-
We have several switches with scrapes that last several minutes. So I have defined a job in prometheus like this:
I expect a sample every 30 minutes, but every 30 minutes I find a series of 20 samples separated by 15 seconds. Is this the expected behavior? What sense does it have? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That is expected behavior. It is related to the way Prometheus lookback/staleness handling works. Prometheus timestamps are accurate to the millisecond. So it looks back in time from the point in the graph, up to 5 minutes, in order to present the data at time X,Y,Z. Because your scrape interval is much slower, you're always going to run into this staleness issue. Grafana has a default "step", configured in the datasource. This is the "Step" in the per-query Options in your dashboard. If you set the "Min Step" to 30m, it will better align your data points. |
Beta Was this translation helpful? Give feedback.
That is expected behavior.
It is related to the way Prometheus lookback/staleness handling works. Prometheus timestamps are accurate to the millisecond. So it looks back in time from the point in the graph, up to 5 minutes, in order to present the data at time X,Y,Z.
Because your scrape interval is much slower, you're always going to run into this staleness issue.
Grafana has a default "step", configured in the datasource. This is the "Step" in the per-query Options in your dashboard. If you set the "Min Step" to 30m, it will better align your data points.
Here's a good video on Prometheus data handling.