Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 18 additions & 54 deletions content/commands/ts.mrange.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,50 +53,9 @@ arguments:
optional: true
token: ALIGN
type: integer
- arguments:
- name: avg
token: AVG
type: pure-token
- name: first
token: FIRST
type: pure-token
- name: last
token: LAST
type: pure-token
- name: min
token: MIN
type: pure-token
- name: max
token: MAX
type: pure-token
- name: sum
token: SUM
type: pure-token
- name: range
token: RANGE
type: pure-token
- name: count
token: COUNT
type: pure-token
- name: std.p
token: STD.P
type: pure-token
- name: std.s
token: STD.S
type: pure-token
- name: var.p
token: VAR.P
type: pure-token
- name: var.s
token: VAR.S
type: pure-token
- name: twa
since: 1.8.0
token: TWA
type: pure-token
name: aggregator
- name: aggregationType
token: AGGREGATION
type: oneof
type: string
- name: bucketDuration
type: integer
- name: buckettimestamp
Expand Down Expand Up @@ -165,15 +124,14 @@ stack_path: docs/data-types/timeseries
summary: Query a range across multiple time series by filters in forward direction
syntax: "TS.MRANGE fromTimestamp toTimestamp\n [LATEST]\n [FILTER_BY_TS ts...]\n\
\ [FILTER_BY_VALUE min max]\n [WITHLABELS | <SELECTED_LABELS label...>]\n [COUNT\
\ count]\n [[ALIGN align] AGGREGATION aggregator bucketDuration [BUCKETTIMESTAMP\
\ count]\n [[ALIGN align] AGGREGATION aggregators bucketDuration [BUCKETTIMESTAMP\
\ bt] [EMPTY]]\n FILTER filterExpr...\n [GROUPBY label REDUCE reducer]\n"
syntax_fmt: "TS.MRANGE fromTimestamp toTimestamp [LATEST] [FILTER_BY_TS\_Timestamp\n\
\ [Timestamp ...]] [FILTER_BY_VALUE min max] [WITHLABELS |\n SELECTED_LABELS label1\
\ [label1 ...]] [COUNT\_count] [[ALIGN\_value]\n AGGREGATION\_<AVG | FIRST | LAST\
\ | MIN | MAX | SUM | RANGE | COUNT\n | STD.P | STD.S | VAR.P | VAR.S | TWA> bucketDuration\n\
\ [BUCKETTIMESTAMP] [EMPTY]] FILTER\_<l=v | l!=v | l= | l!= |\n l=(v1,v2,...)\
\ | l!=(v1,v2,...) [l=v | l!=v | l= | l!= |\n l=(v1,v2,...) | l!=(v1,v2,...) ...]>\
\ [GROUPBY label REDUCE\n reducer]"
\ [label1 ...]] [COUNT\_count] [[ALIGN\_value]\n AGGREGATION\ aggregators bucketDuration\
\ [BUCKETTIMESTAMP]\n [EMPTY]] FILTER\_<l=v | l!=v | l= | l!= | l=(v1,v2,...) |\n\
\ l!=(v1,v2,...) [l=v | l!=v | l= | l!= | l=(v1,v2,...) |\n l!=(v1,v2,...) ...]>\
\ [GROUPBY label REDUCE reducer]"
title: TS.MRANGE
---
{{< note >}}
Expand Down Expand Up @@ -288,13 +246,13 @@ Values include:
</details>

<details open>
<summary><code>AGGREGATION aggregator bucketDuration</code></summary>
<summary><code>AGGREGATION aggregators bucketDuration</code></summary>

per time series, aggregates samples into time buckets, where:
for each time series, aggregates samples into time buckets, where:

- `aggregator` takes one of the following aggregation types:
- `aggregators` is one or more comma-separated aggregator from the following table:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aggregator --> aggregators


| `aggregator` | Description |
| aggregator | Description |
| ------------ | --------------------------------------------------------------- |
| `avg` | Arithmetic mean of all non-NaN values |
| `sum` | Sum of all non-NaN values |
Expand All @@ -313,6 +271,11 @@ per time series, aggregates samples into time buckets, where:
| `twa` | Time-weighted average over the bucket's timeframe (ignores NaN values) (since RedisTimeSeries 1.8) |

- `bucketDuration` is duration of each bucket, in milliseconds.

Note: `aggregators` can either be a single aggregator or multiple aggregators separated by commas as shown below.
No whitespace is allowed between aggregators.

AGGREGATION min,avg,max

Without `ALIGN`, bucket start times are multiples of `bucketDuration`.

Expand All @@ -338,7 +301,7 @@ controls how bucket timestamps are reported.

is a flag, which, when specified, reports aggregations also for empty buckets.

| `aggregator` | Value reported for each empty bucket |
| `aggregators` | Value reported for each empty bucket |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aggregators --> aggregator?

| -------------------- | ------------------------------------ |
| `sum`, `count` | `0` |
| `last` | The value of the last sample before the bucket's start. `NaN` when no such sample. |
Expand All @@ -354,6 +317,7 @@ Regardless of the values of `fromTimestamp` and `toTimestamp`, no data is report
splits time series into groups, each group contains time series that share the same value for the provided label name, then aggregates results in each group.

When combined with `AGGREGATION` the `GROUPBY`/`REDUCE` is applied post aggregation stage.
`GROUPBY`/`REDUCE` is not permitted when multiple aggregators are specified.

- `label` is label name. A group is created for all time series that share the same value for this label.

Expand Down
72 changes: 18 additions & 54 deletions content/commands/ts.mrevrange.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,50 +53,9 @@ arguments:
optional: true
token: ALIGN
type: integer
- arguments:
- name: avg
token: AVG
type: pure-token
- name: first
token: FIRST
type: pure-token
- name: last
token: LAST
type: pure-token
- name: min
token: MIN
type: pure-token
- name: max
token: MAX
type: pure-token
- name: sum
token: SUM
type: pure-token
- name: range
token: RANGE
type: pure-token
- name: count
token: COUNT
type: pure-token
- name: std.p
token: STD.P
type: pure-token
- name: std.s
token: STD.S
type: pure-token
- name: var.p
token: VAR.P
type: pure-token
- name: var.s
token: VAR.S
type: pure-token
- name: twa
since: 1.8.0
token: TWA
type: pure-token
name: aggregator
- name: aggregators
token: AGGREGATION
type: oneof
type: string
- name: bucketDuration
type: integer
- name: buckettimestamp
Expand Down Expand Up @@ -165,15 +124,14 @@ stack_path: docs/data-types/timeseries
summary: Query a range across multiple time-series by filters in reverse direction
syntax: "TS.MREVRANGE fromTimestamp toTimestamp\n [LATEST]\n [FILTER_BY_TS ts...]\n\
\ [FILTER_BY_VALUE min max]\n [WITHLABELS | <SELECTED_LABELS label...>]\n [COUNT\
\ count]\n [[ALIGN align] AGGREGATION aggregator bucketDuration [BUCKETTIMESTAMP\
\ count]\n [[ALIGN align] AGGREGATION aggregators bucketDuration [BUCKETTIMESTAMP\
\ bt] [EMPTY]]\n FILTER filterExpr...\n [GROUPBY label REDUCE reducer]\n"
syntax_fmt: "TS.MREVRANGE fromTimestamp toTimestamp [LATEST]\n [FILTER_BY_TS\_Timestamp\
\ [Timestamp ...]] [FILTER_BY_VALUE min max]\n [WITHLABELS | SELECTED_LABELS label1\
\ [label1 ...]] [COUNT\_count]\n [[ALIGN\_value] AGGREGATION\_<AVG | FIRST | LAST\
\ | MIN | MAX | SUM |\n RANGE | COUNT | STD.P | STD.S | VAR.P | VAR.S | TWA>\n\
\ bucketDuration [BUCKETTIMESTAMP] [EMPTY]] FILTER\_<l=v | l!=v | l=\n | l!= |\
\ l=(v1,v2,...) | l!=(v1,v2,...) [l=v | l!=v | l= | l!= |\n l=(v1,v2,...) | l!=(v1,v2,...)\
\ ...]> [GROUPBY label REDUCE\n reducer]"
\ [label1 ...]] [COUNT\_count]\n [[ALIGN\_value] AGGREGATION\ aggregators bucketDuration\n\
\ [BUCKETTIMESTAMP] [EMPTY]] FILTER\_<l=v | l!=v | l= | l!= |\n l=(v1,v2,...)\
\ | l!=(v1,v2,...) [l=v | l!=v | l= | l!= |\n l=(v1,v2,...) | l!=(v1,v2,...) ...]>\
\ [GROUPBY label REDUCE\n reducer]"
title: TS.MREVRANGE
---
{{< note >}}
Expand Down Expand Up @@ -288,13 +246,13 @@ Values include:
</details>

<details open>
<summary><code>AGGREGATION aggregator bucketDuration</code></summary>
<summary><code>AGGREGATION aggregators bucketDuration</code></summary>

per time series, aggregates samples into time buckets, where:
for each time series, aggregates samples into time buckets, where:

- `aggregator` takes one of the following aggregation types:
- `aggregators` is one or more comma-separated aggregator from the following table:

| `aggregator` | Description |
| aggregator | Description |
| ------------ | --------------------------------------------------------------- |
| `avg` | Arithmetic mean of all non-NaN values |
| `sum` | Sum of all non-NaN values |
Expand All @@ -313,6 +271,11 @@ per time series, aggregates samples into time buckets, where:
| `twa` | Time-weighted average over the bucket's timeframe (ignores NaN values) (since RedisTimeSeries 1.8) |

- `bucketDuration` is duration of each bucket, in milliseconds.

Note: `aggregators` can either be a single aggregator or multiple aggregators separated by commas as shown below.
No whitespace is allowed between aggregators.

AGGREGATION min,avg,max

Without `ALIGN`, bucket start times are multiples of `bucketDuration`.

Expand All @@ -338,7 +301,7 @@ controls how bucket timestamps are reported.

is a flag, which, when specified, reports aggregations also for empty buckets.

| `aggregator` | Value reported for each empty bucket |
| `aggregators` | Value reported for each empty bucket |
| -------------------- | ------------------------------------ |
| `sum`, `count` | `0` |
| `last` | The value of the last sample before the bucket's start. `NaN` when no such sample. |
Expand All @@ -354,6 +317,7 @@ Regardless of the values of `fromTimestamp` and `toTimestamp`, no data is report
splits time series into groups, each group contains time series that share the same value for the provided label name, then aggregates results in each group.

When combined with `AGGREGATION` the `GROUPBY`/`REDUCE` is applied post aggregation stage.
`GROUPBY`/`REDUCE` is not permitted when multiple aggregators are specified.

- `label` is label name. A group is created for all time series that share the same value for this label.

Expand Down
73 changes: 19 additions & 54 deletions content/commands/ts.range.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,50 +39,9 @@ arguments:
optional: true
token: ALIGN
type: integer
- arguments:
- name: avg
token: AVG
type: pure-token
- name: first
token: FIRST
type: pure-token
- name: last
token: LAST
type: pure-token
- name: min
token: MIN
type: pure-token
- name: max
token: MAX
type: pure-token
- name: sum
token: SUM
type: pure-token
- name: range
token: RANGE
type: pure-token
- name: count
token: COUNT
type: pure-token
- name: std.p
token: STD.P
type: pure-token
- name: std.s
token: STD.S
type: pure-token
- name: var.p
token: VAR.P
type: pure-token
- name: var.s
token: VAR.S
type: pure-token
- name: twa
since: 1.8.0
token: TWA
type: pure-token
name: aggregator
- name: aggregators
token: AGGREGATION
type: oneof
type: string
- name: bucketDuration
type: integer
- name: buckettimestamp
Expand Down Expand Up @@ -120,12 +79,11 @@ since: 1.0.0
stack_path: docs/data-types/timeseries
summary: Query a range in forward direction
syntax: "TS.RANGE key fromTimestamp toTimestamp\n [LATEST]\n [FILTER_BY_TS ts...]\n\
\ [FILTER_BY_VALUE min max]\n [COUNT count] \n [[ALIGN align] AGGREGATION aggregator\
\ [FILTER_BY_VALUE min max]\n [COUNT count] \n [[ALIGN align] AGGREGATION aggregators\
\ bucketDuration [BUCKETTIMESTAMP bt] [EMPTY]]\n"
syntax_fmt: "TS.RANGE key fromTimestamp toTimestamp [LATEST]\n [FILTER_BY_TS\_Timestamp\
\ [Timestamp ...]] [FILTER_BY_VALUE min max]\n [COUNT\_count] [[ALIGN\_value] AGGREGATION\_\
<AVG | FIRST | LAST | MIN\n | MAX | SUM | RANGE | COUNT | STD.P | STD.S | VAR.P\
\ | VAR.S | TWA>\n bucketDuration [BUCKETTIMESTAMP] [EMPTY]]"
aggregators bucketDuration [BUCKETTIMESTAMP] [EMPTY]]"
title: TS.RANGE
---

Expand Down Expand Up @@ -204,13 +162,13 @@ is a time bucket alignment control for `AGGREGATION`. It controls the time bucke
</details>

<details open>
<summary><code>AGGREGATION aggregator bucketDuration</code></summary>
<summary><code>AGGREGATION aggregators bucketDuration</code></summary>

aggregates samples into time buckets, where:
for each time series, aggregates samples into time buckets, where:

- `aggregator` takes one of the following aggregation types:
- `aggregators` is one or more comma-separated aggregator from the following table:

| `aggregator` | Description |
| aggregator | Description |
| ------------ | --------------------------------------------------------------- |
| `avg` | Arithmetic mean of all non-NaN values |
| `sum` | Sum of all non-NaN values |
Expand All @@ -229,6 +187,11 @@ aggregates samples into time buckets, where:
| `twa` | Time-weighted average over the bucket's timeframe (ignores NaN values) (since RedisTimeSeries 1.8) |

- `bucketDuration` is duration of each bucket, in milliseconds.

Note: `aggregators` can either be a single aggregator or multiple aggregators separated by commas as shown below.
No whitespace is allowed between aggregators.

AGGREGATION min,avg,max

Without `ALIGN`, bucket start times are multiples of `bucketDuration`.

Expand All @@ -254,7 +217,7 @@ controls how bucket timestamps are reported.

is a flag, which, when specified, reports aggregations also for empty buckets.

| `aggregator` | Value reported for each empty bucket |
| `aggregators` | Value reported for each empty bucket |
| -------------------- | ------------------------------------ |
| `sum`, `count` | `0` |
| `last` | The value of the last sample before the bucket's start. `NaN` when no such sample. |
Expand Down Expand Up @@ -297,12 +260,14 @@ TS.RANGE temp:TLV - + FILTER_BY_VALUE -100 100
2) 40
{{< / highlight >}}

Now, retrieve the average value, while ignoring out-of-range values.
Now, retrieve the minimum, average, and maximum values, while ignoring out-of-range values.

{{< highlight bash >}}
TS.RANGE temp:TLV - + FILTER_BY_VALUE -100 100 AGGREGATION avg 1000
TS.RANGE temp:TLV - + FILTER_BY_VALUE -100 100 AGGREGATION min,avg,max 1000
1) 1) (integer) 1000
2) 35
2) 30
3) 35
4) 40
{{< / highlight >}}
</details>

Expand Down
Loading
Loading