diff --git a/content/commands/ts.add.md b/content/commands/ts.add.md index 48b6141925..e8684cef76 100644 --- a/content/commands/ts.add.md +++ b/content/commands/ts.add.md @@ -112,7 +112,7 @@ Unix time is the number of milliseconds that have elapsed since 00:00:00 UTC on
value -is (double) numeric data value of the sample. The double number should follow [RFC 7159](https://tools.ietf.org/html/rfc7159) (JSON standard). In particular, the parser rejects overly large values that do not fit in binary64. It does not accept NaN or infinite values. +is (double) numeric data value of the sample. The double number should follow [RFC 7159](https://tools.ietf.org/html/rfc7159) (JSON standard). In particular, the parser rejects overly large values that do not fit in binary64. It does not accept infinite values. NaN (Not a Number) values are supported starting from Redis 8.6.
Notes: @@ -173,6 +173,8 @@ This override is effective only for this single command and does not set the tim - `MAX`: only override if the value is higher than the existing value - `SUM`: If a previous sample exists, add the new sample to it so that the updated value is set to (previous + new). If no previous sample exists, the value is set to the new value. +NaN Handling (Redis 8.6+): When using `MIN`, `MAX`, or `SUM` policies, an error is returned if there is an existing value in the specified timestamp and either the previous or the new value (but not both) are NaN. + This argument has no effect when a new time series is created by this command. @@ -192,6 +194,8 @@ When not specified: set to the global [IGNORE_MAX_TIME_DIFF]({{< relref "develop These parameters are used when creating a new time series to set the per-key parameters, and are ignored when called with an existing time series (the existing per-key configuration parameters is used). +NaN Handling (Redis 8.6+): NaN values are never regarded as duplicates when using the `IGNORE` parameters. +
LABELS {label value}... diff --git a/content/commands/ts.createrule.md b/content/commands/ts.createrule.md index c996416ac5..ad9835f44c 100644 --- a/content/commands/ts.createrule.md +++ b/content/commands/ts.createrule.md @@ -49,6 +49,14 @@ arguments: since: 1.8.0 token: TWA type: pure-token + - name: countNaN + since: 8.6.0 + token: COUNTNAN + type: pure-token + - name: countAll + since: 8.6.0 + token: COUNTALL + type: pure-token name: aggregator token: AGGREGATION type: oneof @@ -69,7 +77,7 @@ categories: - kubernetes - clients complexity: O(1) -description: Create a compaction rule +description: Create a compaction rule. group: timeseries hidden: false linkTitle: TS.CREATERULE @@ -110,19 +118,21 @@ aggregates results into time buckets. | `aggregator` | Description | | ------------ | ------------------------------------------------------------------------------ | - | `avg` | Arithmetic mean of all values | - | `sum` | Sum of all values | - | `min` | Minimum value | - | `max` | Maximum value | - | `range` | Difference between the highest and the lowest value | - | `count` | Number of values | - | `first` | Value with lowest timestamp in the bucket | - | `last` | Value with highest timestamp in the bucket | - | `std.p` | Population standard deviation of the values | - | `std.s` | Sample standard deviation of the values | - | `var.p` | Population variance of the values | - | `var.s` | Sample variance of the values | - | `twa` | Time-weighted average over the bucket's timeframe (since RedisTimeSeries v1.8) | + | `avg` | Arithmetic mean of all non-NaN values (ignores NaN values) | + | `sum` | Sum of all non-NaN values (ignores NaN values) | + | `min` | Minimum non-NaN value (ignores NaN values) | + | `max` | Maximum non-NaN value (ignores NaN values) | + | `range` | Difference between the highest and the lowest non-NaN value (ignores NaN values) | + | `count` | Number of non-NaN values (ignores NaN values) | + | `countNaN` | Number of NaN values (since Redis 8.6) | + | `countAll` | Number of all values, both NaN and non-NaN (since Redis 8.6) | + | `first` | Value with lowest timestamp in the bucket (ignores NaN values) | + | `last` | Value with highest timestamp in the bucket (ignores NaN values) | + | `std.p` | Population standard deviation of the non-NaN values (ignores NaN values) | + | `std.s` | Sample standard deviation of the non-NaN values (ignores NaN values) | + | `var.p` | Population variance of the non-NaN values (ignores NaN values) | + | `var.s` | Sample variance of the non-NaN values (ignores NaN values) | + | `twa` | Time-weighted average over the bucket's timeframe (ignores NaN values). Added in RedisTimeSeries 1.8. | - `bucketDuration` is duration of each bucket, in milliseconds. diff --git a/content/commands/ts.decrby.md b/content/commands/ts.decrby.md index 1da581fa52..b5151943b5 100644 --- a/content/commands/ts.decrby.md +++ b/content/commands/ts.decrby.md @@ -112,7 +112,7 @@ is key name for the time series.
subtrahend -is numeric value of the subtrahend (double). +is numeric value of the subtrahend (double). An error is returned if the subtrahend is NaN.
Notes @@ -133,8 +133,10 @@ Unix time is the number of milliseconds that have elapsed since 00:00:00 UTC on `timestamp` must be equal to or higher than the maximum existing timestamp. When equal, the value of the sample with the maximum existing timestamp is decreased. If it is higher, a new sample with a timestamp set to `timestamp` is created, and its value is set to the value of the sample with the maximum existing timestamp minus `subtrahend`. If the time series is empty, the value is set to `subtrahend`. - + When not specified, the timestamp is set to the Unix time of the server's clock. + +NaN Handling (Redis 8.6+): An error is returned if the current value at the maximum existing timestamp is NaN.
RETENTION retentionPeriod diff --git a/content/commands/ts.get.md b/content/commands/ts.get.md index ffaaaa903a..f156d819a5 100644 --- a/content/commands/ts.get.md +++ b/content/commands/ts.get.md @@ -34,7 +34,7 @@ syntax_fmt: TS.GET key [LATEST] title: TS.GET --- -Get the sample with the highest timestamp from a given time series +Get the sample with the highest timestamp from a given time series. Starting from Redis 8.6, NaN values are included in the results. [Examples](#examples) diff --git a/content/commands/ts.incrby.md b/content/commands/ts.incrby.md index 5d0b968fb4..089c345d15 100644 --- a/content/commands/ts.incrby.md +++ b/content/commands/ts.incrby.md @@ -112,7 +112,7 @@ is key name for the time series.
addend -is numeric value of the addend (double). +is numeric value of the addend (double). An error is returned if the addend is NaN.
Notes @@ -132,9 +132,11 @@ Unix time is the number of milliseconds that have elapsed since 00:00:00 UTC on `timestamp` must be equal to or higher than the maximum existing timestamp. When equal, the value of the sample with the maximum existing timestamp is increased. If it is higher, a new sample with a timestamp set to `timestamp` is created, and its value is set to the value of the sample with the maximum existing timestamp plus `addend`. -If the time series is empty, the value is set to `addend`. - +If the time series is empty, the value is set to `addend`. + When not specified, the timestamp is set to the Unix time of the server's clock. + +NaN Handling (Redis 8.6+): An error is returned if the current value at the maximum existing timestamp is NaN.
RETENTION retentionPeriod diff --git a/content/commands/ts.madd.md b/content/commands/ts.madd.md index f8a7cce69c..03790e0f8e 100644 --- a/content/commands/ts.madd.md +++ b/content/commands/ts.madd.md @@ -62,7 +62,7 @@ Unix time is the number of milliseconds that have elapsed since 00:00:00 UTC on
value -is numeric data value of the sample (double). The double number should follow RFC 7159 (a JSON standard). The parser rejects overly large values that would not fit in binary64. It does not accept NaN or infinite values. +is numeric data value of the sample (double). The double number should follow RFC 7159 (JSON standard). The parser rejects overly large values that would not fit in binary64. It does not accept infinite values. NaN (Not a Number) values are supported starting from Redis 8.6.
Notes: diff --git a/content/commands/ts.mget.md b/content/commands/ts.mget.md index c2ac0412ab..1971e30cfc 100644 --- a/content/commands/ts.mget.md +++ b/content/commands/ts.mget.md @@ -70,7 +70,7 @@ syntax_fmt: "TS.MGET [LATEST] [WITHLABELS | SELECTED_LABELS label1 [label1 ...]] title: TS.MGET --- -Get the sample with the highest timestamp from each time series matching a specific filter. +Get the sample with the highest timestamp from each time series matching a specific filter. Starting from Redis 8.6, NaN values are included in the results. {{< note >}} This command will reply only if the current user has read access to all keys that match the filter. diff --git a/content/commands/ts.mrange.md b/content/commands/ts.mrange.md index 79efec175e..9da5db9657 100644 --- a/content/commands/ts.mrange.md +++ b/content/commands/ts.mrange.md @@ -177,7 +177,7 @@ syntax_fmt: "TS.MRANGE fromTimestamp toTimestamp [LATEST] [FILTER_BY_TS\_Timesta title: TS.MRANGE --- -Query a range across multiple time series by filters in the forward direction. +Query a range across multiple time series by filters in the forward direction. Starting from Redis 8.6, NaN values are included in raw measurement reports (queries without aggregation). {{< note >}} This command will reply only if the current user has read access to all keys that match the filter. @@ -240,7 +240,7 @@ When used together with `AGGREGATION`: samples are filtered before being aggrega
FILTER_BY_VALUE min max (since RedisTimeSeries v1.6) -filters samples by minimum and maximum values. +filters samples by minimum and maximum values. `min` and `max` cannot be NaN values. When used together with `AGGREGATION`: samples are filtered before being aggregated.
@@ -291,19 +291,21 @@ per time series, aggregates samples into time buckets, where: | `aggregator` | Description | | ------------ | ------------------------------------------------------------------------------ | - | `avg` | Arithmetic mean of all values | - | `sum` | Sum of all values | - | `min` | Minimum value | - | `max` | Maximum value | - | `range` | Difference between maximum value and minimum value | - | `count` | Number of values | - | `first` | Value with lowest timestamp in the bucket | - | `last` | Value with highest timestamp in the bucket | - | `std.p` | Population standard deviation of the values | - | `std.s` | Sample standard deviation of the values | - | `var.p` | Population variance of the values | - | `var.s` | Sample variance of the values | - | `twa` | Time-weighted average over the bucket's timeframe (since RedisTimeSeries v1.8) | + | `avg` | Arithmetic mean of all non-NaN values (ignores NaN values) | + | `sum` | Sum of all non-NaN values (ignores NaN values) | + | `min` | Minimum non-NaN value (ignores NaN values) | + | `max` | Maximum non-NaN value (ignores NaN values) | + | `range` | Difference between maximum non-NaN value and minimum non-NaN value (ignores NaN values) | + | `count` | Number of non-NaN values (ignores NaN values) | + | `countNaN` | Number of NaN values (since Redis 8.6) | + | `countAll` | Number of all values, both NaN and non-NaN (since Redis 8.6) | + | `first` | Value with lowest timestamp in the bucket (ignores NaN values) | + | `last` | Value with highest timestamp in the bucket (ignores NaN values) | + | `std.p` | Population standard deviation of the non-NaN values (ignores NaN values) | + | `std.s` | Sample standard deviation of the non-NaN values (ignores NaN values) | + | `var.p` | Population variance of the non-NaN values (ignores NaN values) | + | `var.s` | Sample variance of the non-NaN values (ignores NaN values) | + | `twa` | Time-weighted average over the bucket's timeframe (ignores NaN values). Added in RedisTimeSeries v1.8. | - `bucketDuration` is duration of each bucket, in milliseconds. @@ -354,16 +356,18 @@ When combined with `AGGREGATION` the `GROUPBY`/`REDUCE` is applied post aggregat | `reducer` | Description | | --------- | ----------------------------------------------------------------------------------------------- | - | `avg` | Arithmetic mean of all non-NaN values (since RedisTimeSeries v1.8) | - | `sum` | Sum of all non-NaN values | - | `min` | Minimum non-NaN value | - | `max` | Maximum non-NaN value | - | `range` | Difference between maximum non-NaN value and minimum non-NaN value (since RedisTimeSeries v1.8) | - | `count` | Number of non-NaN values (since RedisTimeSeries v1.8) | - | `std.p` | Population standard deviation of all non-NaN values (since RedisTimeSeries v1.8) | - | `std.s` | Sample standard deviation of all non-NaN values (since RedisTimeSeries v1.8) | - | `var.p` | Population variance of all non-NaN values (since RedisTimeSeries v1.8) | - | `var.s` | Sample variance of all non-NaN values (since RedisTimeSeries v1.8) | + | `avg` | Arithmetic mean of all non-NaN values (ignores NaN values). Added in RedisTimeSeries v1.8. | + | `sum` | Sum of all non-NaN values (ignores NaN values) | + | `min` | Minimum non-NaN value (ignores NaN values) | + | `max` | Maximum non-NaN value (ignores NaN values) | + | `range` | Difference between maximum non-NaN value and minimum non-NaN value (ignores NaN values) | + | `count` | Number of non-NaN values (ignores NaN values) | + | `countNaN`| Number of NaN values (since Redis 8.6) | + | `countAll`| Number of all values, both NaN and non-NaN (since Redis 8.6) | + | `std.p` | Population standard deviation of all non-NaN values (ignores NaN values) | + | `std.s` | Sample standard deviation of all non-NaN values (ignores NaN values) | + | `var.p` | Population variance of all non-NaN values (ignores NaN values) | + | `var.s` | Sample variance of all non-NaN values (ignores NaN values) | Notes: - The produced time series is named `