Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(aggregators.derivative): add explanation of calculations #12758

Merged
merged 1 commit into from
Mar 1, 2023
Merged
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
15 changes: 7 additions & 8 deletions plugins/aggregators/derivative/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ To avoid thinking about border values, we consider periods to be inclusive at
the start but exclusive in the end. Using `period = "10s"` and `max_roll_over =
0` we would get the following aggregates:

| timestamp | value | aggregate | explanantion |
| timestamp | value | aggregate | explanation |
|-----------|-------|-----------|--------------|
| 0 | 0.0 |
| 2 | 2.0 |
Expand All @@ -162,7 +162,7 @@ aggregator will emit the log messages `Same first and last event for "test",
skipping.`. This changes, if we use `max_roll_over = 1`, since now end
measurements of a period are taking as start for the next period.

| timestamp | value | aggregate | explanantion |
| timestamp | value | aggregate | explanation |
|-----------|-------|-----------|--------------|
| 0 | 0.0 |
| 2 | 2.0 | 1.0 | (2.0 - 0.0) / (2 - 0) |
Expand All @@ -183,25 +183,24 @@ There may be a slight difference in the calculation when using `max_roll_over`
compared to running without. To illustrate this, let us compare the derivatives
for `period = "7s"`.

| timestamp | value | `max_roll_over = 0` | `max_roll_over = 1` |
|-----------|-------|-----------|--------------|
| timestamp | value | `max_roll_over = 0` | explanation | `max_roll_over = 1` | explanation |
|-----------|-------|---------------------|-------------|---------------------|-------------|
| 0 | 0.0 |
| 2 | 2.0 |
| 4 | 4.0 |
| 6 | 6.0 |
||| 1.0 | 1.0 |
| 7 | | 0.8571... | (6-0) / (7-0) | 0.8571... | (6-0) / (7-0)
| 8 | 8.0 |
| 10 | 10.0 |
| 12 | 8.0 |
||| 0.0 | 0.33... |
| 14 | 6.0 |
| 14 | 8.0 | 0.0 | (8-8) / (14-7) | 0.2857... | (8-6) / (14-7)
| 16 | 4.0 |
| 18 | 2.0 |
| 20 | 0.0 |
||| -1.0 | -1.0 |

The difference stems from the change of the value between periods, e.g. from 6.0
to 8.0 between first and second period. Thoses changes are omitted with
to 8.0 between first and second period. Those changes are omitted with
`max_roll_over = 0` but are respected with `max_roll_over = 1`. That there are
no more differences in the calculated derivatives is due to the example data,
which has constant derivatives in during the first and last period, even when
Expand Down