Evaluates query over range of time.
GET {{baseUrl}}/query_range?query=num_threads&start=2023-02-13T09:48:43Z&end=2023-02-14T09:48:43Z&step=15s
The following endpoint evaluates an expression query over a range of time
You can URL-encode these parameters directly in the request body by using the POST
method and Content-Type: application/x-www-form-urlencoded
header. This is useful when specifying a large query that may breach server-side URL character limits.
The data section of the query result has the following format
{
"resultType": "matrix",
"result": <value>
}
For the format of the <value>
placeholder, see the range-vector result format.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
query | string | (Required) Prometheus expression query string. |
Example: ?query=up
|
| start
| string | | Start timestamp.
Example: &start=2015-07-01T20:10:30.781Z
|
| end
| string | | End timestamp.
Example: &end=2015-07-01T20:11:00.781Z
|
| step
| string | | Query resolution step width in duration
format or float number of seconds.
Example: &step=15s
|
| timeout
| string | | Evaluation timeout. Optional. Defaults to and is capped by the value of the -query.timeout
flag.
Example: ?metric=http_requests_total
|
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Accept | string |
RESPONSES
status: OK
{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"up","job":"prometheus","instance":"localhost:9090"},"values":[[1435781430.781,"1"],[1435781445.781,"1"],[1435781460.781,"1"]]},{"metric":{"__name__":"up","job":"node","instance":"localhost:9091"},"values":[[1435781430.781,"0"],[1435781445.781,"0"],[1435781460.781,"1"]]}]}}