Understanding Range Duration with Prometheus Range Queries

Hello Prometheus Community,

I have a question regarding evaluating range vectors within a range query. Specifically, I’m trying to understand how Prometheus processes the range vector in conjunction with the given start time, end time, and step interval in the query.

Here’s a sample query for context:

rate(demo_api_request_duration_seconds_bucket{instance = "demo-service-0:10000", method="GET"}[10m])

Assume we have a range query with a start time, an end time, and a step interval. My question is about the internal mechanics of how Prometheus evaluates this range vector over the specified time range.

  1. Does Prometheus evaluates range vector for each step from start to end duration provided in range query?
  2. How does the [10m] range duration interact with the overall query start and end times?
  3. Could you illustrate this with a sample example to clarify?

Example range_query parameters

query: rate(demo_api_request_duration_seconds_bucket{instance = "demo-service-0:10000",method="GET"}[10m])
start: 1720073957.861
end: 1720074017.861
step: 2