Evaluates instant query
GET {{baseUrl}}/query?query=num_threads
The following endpoint evaluates an instant query at a single point in 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" | "vector" | "scalar" | "string",
"result": <value>
}
<value>
refers to the query result data, which has varying formats depending on the resultType
. See the expression query result formats.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
query | string | (Required) Prometheus expression query string. |
Example: ?query=up
|
| time
| string | | Evaluation timestamp. Optional.
The current server time is used if the time
parameter is omitted.
Example: ?metric=http_requests_total
|
| 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":"vector","result":[{"metric":{"__name__":"up","job":"prometheus","instance":"localhost:9090"},"value":[1435781451.781,"1"]},{"metric":{"__name__":"up","job":"node","instance":"localhost:9100"},"value":[1435781451.781,"0"]}]}}