docs: specify results of Instant and Range queries

Mention explicitly what are value and timestamp field in returned
results from Instant and Range queries.

Updates
https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5710
https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5708

Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
hagen1778 2024-01-29 14:00:14 +01:00
parent 24eb1ad0c8
commit b5978ed8f9
No known key found for this signature in database
GPG Key ID: 3BF75F3741CA9640

View File

@ -499,7 +499,7 @@ The API consists of two main handlers for serving [instant queries](#instant-que
### Instant query
Instant query executes the query expression at the given timestamp:
Instant query executes the `query` expression at the given `time`:
```
GET | POST /api/v1/query?query=...&time=...&step=...
@ -516,6 +516,10 @@ Params:
For example, the request `/api/v1/query?query=up&step=1m` will look for the last written raw sample for the metric `up`
in the interval between `now()` and `now()-1m`. If omitted, `step` is set to `5m` (5 minutes).
The result of Instant query is a list of [time series](https://docs.victoriametrics.com/keyConcepts.html#time-series)
matching the filter in `query` expression. Each series will have exactly one [raw sample](https://docs.victoriametrics.com/keyConcepts.html#raw-samples),
where value will contain result of `query` expression, and timestamp - the requested `time`.
To understand how instant queries work, let's begin with a data sample:
```
@ -557,7 +561,7 @@ curl "http://<victoria-metrics-addr>/api/v1/query?query=foo_bar&time=2022-05-10T
"__name__": "foo_bar"
},
"value": [
1652169780,
1652169780, // 2022-05-10 10:03:00
"3"
]
}
@ -586,7 +590,7 @@ the following scenarios:
### Range query
Range query executes the query expression at the given time range with the given step:
Range query executes the `query` expression at the given `time` range with the given `step`:
```
GET | POST /api/v1/query_range?query=...&start=...&end=...&step=...
@ -604,6 +608,11 @@ Params:
The `query` is executed at `start`, `start+step`, `start+2*step`, ..., `end` timestamps.
If the `step` isn't set, then it default to `5m` (5 minutes).
The result of Range query is a list of [time series](https://docs.victoriametrics.com/keyConcepts.html#time-series)
matching the filter in `query` expression. Each series will have arbitrary number of [raw samples](https://docs.victoriametrics.com/keyConcepts.html#raw-samples),
where value containing result of `query` expression, and timestamp contains the moment in time at which the expression was executed.
In other words, Range query is an [Instant query](#instant-query) executed `(end-start) / step` times.
For example, to get the values of `foo_bar` during the time range from `2022-05-10 09:59:00` to `2022-05-10 10:17:00`,
we need to issue a range query: