Skip to content

Commit

Permalink
IGNORE - doc updates (#311)
Browse files Browse the repository at this point in the history
* IGNORE - doc updates

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md
  • Loading branch information
LiorKogan authored Jun 11, 2024
1 parent e84a686 commit 801a041
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 65 deletions.
26 changes: 8 additions & 18 deletions content/commands/ts.add/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,12 @@ This argument has no effect when a new time series is created by this command.

is the policy for handling duplicate samples. A new sample is considered a duplicate and is ignored if the following conditions are met:

- The difference of the current timestamp from the previous timestamp (`timestamp - max_timestamp`) is less than or equal to `ignoreMaxTimeDiff`;
- The absolute value difference of the current value from the value at the previous maximum timestamp (`abs(value - value_at_max_timestamp`) is less than or equal to `ignoreMaxValDiff`;
- The sample is added in-order (`timestamp ≥ max_timestamp`).

This can be expressed algorithmically as follows:

```
if ((series is not a compaction) &&
(series' DUPLICATE_POLICY == LAST) &&
(timestamp ≥ max_timestamp) &&
(timestamp - max_timestamp ≤ ignoreMaxTimeDiff) &&
abs(value - value_at_max_timestamp) ≤ ignoreMaxValDiff))
ignore sample
```

- The time series is not a compaction;
- The time series' `DUPLICATE_POLICY` IS `LAST`;
- The sample is added in-order (`timestamp ≥ max_timestamp`);
- The difference of the current timestamp from the previous timestamp (`timestamp - max_timestamp`) is less than or equal to `IGNORE_MAX_TIME_DIFF`;
- The absolute value difference of the current value from the value at the previous maximum timestamp (`abs(value - value_at_max_timestamp`) is less than or equal to `IGNORE_MAX_VAL_DIFF`.

where `max_timestamp` is the timestamp of the sample with the largest timestamp in the time series, and `value_at_max_timestamp` is the value at `max_timestamp`.

When not specified: set to the global [IGNORE_MAX_TIME_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff) and [IGNORE_MAX_VAL_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff), which are, by default, both set to 0.
Expand All @@ -215,15 +205,15 @@ Use it only if you are creating a new time series. It is ignored if you are addi

<note><b>Notes:</b>
- You can use this command to create a new time series and add data to it in a single command.
`RETENTION`, `ENCODING`, `CHUNK_SIZE`, `DUPLICATE_POLICY`, and `LABELS` are used only when creating a new time series, and ignored when adding samples to an existing time series.
`RETENTION`, `ENCODING`, `CHUNK_SIZE`, `DUPLICATE_POLICY`, `IGNORE`, and `LABELS` are used only when creating a new time series, and ignored when adding samples to an existing time series.
- Setting `RETENTION` and `LABELS` introduces additional time complexity.
</note>

## Return value

Returns one of these replies:

- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. For an element that is ignored (see the `IGNORE` parameter above), the value will be `max_timestamp`.
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< baseurl >}}/commands/ts.create/)), the reply will be the largest timestamp in the time series.
- [] on error (invalid arguments, wrong key type, etc.), when duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp

## Complexity
Expand Down
14 changes: 3 additions & 11 deletions content/commands/ts.alter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ stack_path: docs/data-types/timeseries
summary: Update the retention, chunk size, duplicate policy, and labels of an existing
time series
syntax: "TS.ALTER key \n [RETENTION retentionPeriod] \n [CHUNK_SIZE size] \n [DUPLICATE_POLICY\
\ policy] \n [IGNORE ignoreMaxTimediff ignoreMaxValDiff] [LABELS [label value ...]]\n"
\ policy] \n [IGNORE ignoreMaxTimediff ignoreMaxValDiff] \n [LABELS [label value ...]]\n"
syntax_fmt: "TS.ALTER key [RETENTION\_retentionPeriod] [CHUNK_SIZE\_size]\n [DUPLICATE_POLICY\_\
<BLOCK | FIRST | LAST | MIN | MAX | SUM>]\n [IGNORE ignoreMaxTimediff ignoreMaxValDiff] [LABELS\ [label value ...]]"
<BLOCK | FIRST | LAST | MIN | MAX | SUM>]\n [IGNORE ignoreMaxTimediff ignoreMaxValDiff] \n [LABELS\ [label value ...]]"
syntax_str: "[RETENTION\_retentionPeriod] [CHUNK_SIZE\_size] [DUPLICATE_POLICY\_<BLOCK\
\ | FIRST | LAST | MIN | MAX | SUM>] [IGNORE ignoreMaxTimediff ignoreMaxValDiff] [LABELS\ [label value ...]]"
title: TS.ALTER
Expand Down Expand Up @@ -105,15 +105,7 @@ is policy for handling multiple samples with identical timestamps. See `DUPLICAT

<details open><summary><code>IGNORE ignoreMaxTimediff ignoreMaxValDiff</code></summary>

is the policy for handling duplicate samples. A new sample is considered a duplicate and is ignored if the following conditions are met:

- The difference of the current timestamp from the previous timestamp (`timestamp - max_timestamp`) is less than or equal to `ignoreMaxTimeDiff`;
- The absolute value difference of the current value from the value at the previous maximum timestamp (`abs(value - value_at_max_timestamp`) is less than or equal to `ignoreMaxValDiff`;
- The sample is added in-order (`timestamp ≥ max_timestamp`).

When not specified: set to the global [IGNORE_MAX_TIME_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff) and [IGNORE_MAX_VAL_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff), which are, by default, both set to 0.

See [`TS.ADD`]({{< baseurl >}}/commands/ts.add/) for more details.
is the policy for handling duplicate samples. See `IGNORE` in [`TS.CREATE`]({{< baseurl >}}/commands/ts.create/).
</details>

<details open><summary><code>LABELS [{label value}...]</code></summary>
Expand Down
12 changes: 7 additions & 5 deletions content/commands/ts.create/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ is policy for handling insertion ([`TS.ADD`]({{< baseurl >}}/commands/ts.add/) a

is the policy for handling duplicate samples. A new sample is considered a duplicate and is ignored if the following conditions are met:

- The difference of the current timestamp from the previous timestamp (`timestamp - max_timestamp`) is less than or equal to `ignoreMaxTimeDiff`;
- The absolute value difference of the current value from the value at the previous maximum timestamp (`abs(value - value_at_max_timestamp`) is less than or equal to `ignoreMaxValDiff`;
- The sample is added in-order (`timestamp ≥ max_timestamp`).
- The time series is not a compaction;
- The time series' `DUPLICATE_POLICY` IS `LAST`;
- The sample is added in-order (`timestamp ≥ max_timestamp`);
- The difference of the current timestamp from the previous timestamp (`timestamp - max_timestamp`) is less than or equal to `IGNORE_MAX_TIME_DIFF`;
- The absolute value difference of the current value from the value at the previous maximum timestamp (`abs(value - value_at_max_timestamp`) is less than or equal to `IGNORE_MAX_VAL_DIFF`.

where `max_timestamp` is the timestamp of the sample with the largest timestamp in the time series, and `value_at_max_timestamp` is the value at `max_timestamp`.

When not specified: set to the global [IGNORE_MAX_TIME_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff) and [IGNORE_MAX_VAL_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff), which are, by default, both set to 0.

See [`TS.ADD`]({{< baseurl >}}/commands/ts.add/) for more details.
</details>

<details open><summary><code>LABELS {label value}...</code></summary>
Expand Down
21 changes: 13 additions & 8 deletions content/commands/ts.decrby/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ is numeric value of the subtrahend (double).
<note><b>Notes</b>
- When specified key does not exist, a new time series is created.
- You can use this command as a counter or gauge that automatically gets history as a time series.
- If a policy for handling duplicate samples (`IGNORE`) is defined for this time series - `TS.DECRBY` operations are affected as well (sample additions/modifications can be filtered).
- Explicitly adding samples to a compacted time series (using [`TS.ADD`]({{< baseurl >}}/commands/ts.add/), [`TS.MADD`]({{< baseurl >}}/commands/ts.madd/), [`TS.INCRBY`]({{< baseurl >}}/commands/ts.incrby/), or `TS.DECRBY`) may result in inconsistencies between the raw and the compacted data. The compaction process may override such samples.
</note>

Expand Down Expand Up @@ -142,13 +143,17 @@ Use it only if you are creating a new time series. It is ignored if you are addi

is the policy for handling duplicate samples. A new sample is considered a duplicate and is ignored if the following conditions are met:

- The difference of the current timestamp from the previous timestamp (`timestamp - max_timestamp`) is less than or equal to `ignoreMaxTimeDiff`;
- The absolute value difference of the current value from the value at the previous maximum timestamp (`abs(value - value_at_max_timestamp`) is less than or equal to `ignoreMaxValDiff`;
- The sample is added in-order (`timestamp ≥ max_timestamp`).
- The time series is not a compaction;
- The time series' `DUPLICATE_POLICY` IS `LAST`;
- The sample is added in-order (`timestamp ≥ max_timestamp`);
- The difference of the current timestamp from the previous timestamp (`timestamp - max_timestamp`) is less than or equal to `IGNORE_MAX_TIME_DIFF`;
- The absolute value difference of the current value from the value at the previous maximum timestamp (`abs(value - value_at_max_timestamp`) is less than or equal to `IGNORE_MAX_VAL_DIFF`.

where `max_timestamp` is the timestamp of the sample with the largest timestamp in the time series, and `value_at_max_timestamp` is the value at `max_timestamp`.

When not specified: set to the global [IGNORE_MAX_TIME_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff) and [IGNORE_MAX_VAL_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff), which are, by default, both set to 0.

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).
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 are used).
</details>

<details open><summary><code>LABELS [{label value}...]</code></summary>
Expand All @@ -159,16 +164,16 @@ Use it only if you are creating a new time series. It is ignored if you are addi
</details>

<note><b>Notes</b>

- You can use this command to add data to a nonexisting time series in a single command. This is why `RETENTION`, `ENCODING`, `CHUNK_SIZE`, `DUPLICATE_POLICY`, and `LABELS` are optional arguments.
- When specified and the key doesn't exist, a new time series is created. Setting the `RETENTION` and `LABELS` introduces additional time complexity.
- You can use this command to create a new time series and add a sample to it in a single command.
`RETENTION`, `ENCODING`, `CHUNK_SIZE`, `DUPLICATE_POLICY`, `IGNORE`, and `LABELS` are used only when creating a new time series, and ignored when adding or modifying samples in an existing time series.
- Setting `RETENTION` and `LABELS` introduces additional time complexity.
</note>

## Return value

Returns one of these replies:

- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< baseurl >}}/commands/ts.create/)), the reply will be the largest timestamp in the time series.
- [] on error (invalid arguments, wrong key type, etc.), or when `timestamp` is not equal to or higher than the maximum existing timestamp

## See also
Expand Down
22 changes: 14 additions & 8 deletions content/commands/ts.incrby/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ is numeric value of the addend (double).
<note><b>Notes</b>
- When specified key does not exist, a new time series is created.
- You can use this command as a counter or gauge that automatically gets history as a time series.
- If a policy for handling duplicate samples (`IGNORE`) is defined for this time series - `TS.INCRBY` operations are affected as well (sample additions/modifications can be filtered).
- Explicitly adding samples to a compacted time series (using [`TS.ADD`]({{< baseurl >}}/commands/ts.add/), [`TS.MADD`]({{< baseurl >}}/commands/ts.madd/), `TS.INCRBY`, or [`TS.DECRBY`]({{< baseurl >}}/commands/ts.decrby/)) may result in inconsistencies between the raw and the compacted data. The compaction process may override such samples.
</note>

Expand All @@ -104,7 +105,7 @@ is Unix time (integer, in milliseconds) specifying the sample timestamp or `*` t

Unix time is the number of milliseconds that have elapsed since 00:00:00 UTC on 1 January 1970, the Unix epoch, without adjustments made due to leap seconds.

`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`.
`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`.

Expand Down Expand Up @@ -143,13 +144,17 @@ Use it only if you are creating a new time series. It is ignored if you are addi

is the policy for handling duplicate samples. A new sample is considered a duplicate and is ignored if the following conditions are met:

- The difference of the current timestamp from the previous timestamp (`timestamp - max_timestamp`) is less than or equal to `ignoreMaxTimeDiff`;
- The absolute value difference of the current value from the value at the previous maximum timestamp (`abs(value - value_at_max_timestamp`) is less than or equal to `ignoreMaxValDiff`;
- The sample is added in-order (`timestamp ≥ max_timestamp`).
- The time series is not a compaction;
- The time series' `DUPLICATE_POLICY` IS `LAST`;
- The sample is added in-order (`timestamp ≥ max_timestamp`);
- The difference of the current timestamp from the previous timestamp (`timestamp - max_timestamp`) is less than or equal to `IGNORE_MAX_TIME_DIFF`;
- The absolute value difference of the current value from the value at the previous maximum timestamp (`abs(value - value_at_max_timestamp`) is less than or equal to `IGNORE_MAX_VAL_DIFF`.

where `max_timestamp` is the timestamp of the sample with the largest timestamp in the time series, and `value_at_max_timestamp` is the value at `max_timestamp`.

When not specified: set to the global [IGNORE_MAX_TIME_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff) and [IGNORE_MAX_VAL_DIFF]({{< baseurl >}}/develop/data-types/timeseries/configuration#ignore_max_time_diff-and-ignore_max_val_diff), which are, by default, both set to 0.

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).
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 are used).
</details>

<details open><summary><code>LABELS [{label value}...]</code></summary>
Expand All @@ -160,15 +165,16 @@ Use it only if you are creating a new time series. It is ignored if you are addi
</details>

<note><b>Notes</b>
- You can use this command to add data to a nonexisting time series in a single command. This is why `RETENTION`, `ENCODING`, `CHUNK_SIZE`, `DUPLICATE_POLICY`, and `LABELS` are optional arguments.
- When specified and the key doesn't exist, a new time series is created. Setting the `RETENTION` and `LABELS` introduces additional time complexity.
- You can use this command to create a new time series and add a sample to it in a single command.
`RETENTION`, `ENCODING`, `CHUNK_SIZE`, `DUPLICATE_POLICY`, `IGNORE`, and `LABELS` are used only when creating a new time series, and ignored when adding or modifying samples in an existing time series.
- Setting `RETENTION` and `LABELS` introduces additional time complexity.
</note>

## Return value

Returns one of these replies:

- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< baseurl >}}/commands/ts.create/)), the reply will be the largest timestamp in the time series.
- [] on error (invalid arguments, wrong key type, etc.), or when `timestamp` is not equal to or higher than the maximum existing timestamp

## Examples
Expand Down
2 changes: 1 addition & 1 deletion content/commands/ts.madd/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ is numeric data value of the sample (double). The double number should follow <a

Returns one of these replies:

- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}), where each element is an [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the timestamp of a upserted sample or an [] (when duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp). For each element that is ignored (see the `IGNORE` option to `TS.ADD` for definitions), the element will have the value `max_timestamp`.
- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}), where each element is an [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the timestamp of a upserted sample or an [] (when duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp). For each element that is ignored (see `IGNORE` in [`TS.CREATE`]({{< baseurl >}}/commands/ts.create/)), the reply element value will be the largest timestamp in the time series.
- [] (invalid arguments, wrong key type, etc.)

## Complexity
Expand Down
Loading

0 comments on commit 801a041

Please sign in to comment.