Skip to content

Commit

Permalink
chore: clean up all markdown lint errors in aggregator plugins (influ…
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj authored Nov 24, 2021
1 parent 6ce4729 commit 96e939a
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 91 deletions.
40 changes: 20 additions & 20 deletions plugins/aggregators/basicstats/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The BasicStats aggregator plugin give us count,diff,max,min,mean,non_negative_diff,sum,s2(variance), stdev for a set of values,
emitting the aggregate every `period` seconds.

### Configuration:
## Configuration

```toml
# Keep the aggregate basicstats of each metric passing through.
Expand All @@ -20,32 +20,32 @@ emitting the aggregate every `period` seconds.
```

- stats
- If not specified, then `count`, `min`, `max`, `mean`, `stdev`, and `s2` are aggregated and pushed as fields. `sum`, `diff` and `non_negative_diff` are not aggregated by default to maintain backwards compatibility.
- If empty array, no stats are aggregated
- If not specified, then `count`, `min`, `max`, `mean`, `stdev`, and `s2` are aggregated and pushed as fields. `sum`, `diff` and `non_negative_diff` are not aggregated by default to maintain backwards compatibility.
- If empty array, no stats are aggregated

### Measurements & Fields:
## Measurements & Fields

- measurement1
- field1_count
- field1_diff (difference)
- field1_rate (rate per second)
- field1_max
- field1_min
- field1_mean
- field1_non_negative_diff (non-negative difference)
- field1_non_negative_rate (non-negative rate per second)
- field1_sum
- field1_s2 (variance)
- field1_stdev (standard deviation)
- field1_interval (interval in nanoseconds)

### Tags:
- field1_count
- field1_diff (difference)
- field1_rate (rate per second)
- field1_max
- field1_min
- field1_mean
- field1_non_negative_diff (non-negative difference)
- field1_non_negative_rate (non-negative rate per second)
- field1_sum
- field1_s2 (variance)
- field1_stdev (standard deviation)
- field1_interval (interval in nanoseconds)

## Tags

No tags are applied by this aggregator.

### Example Output:
## Example Output

```
```shell
$ telegraf --config telegraf.conf --quiet
system,host=tars load1=1 1475583980000000000
system,host=tars load1=1 1475583990000000000
Expand Down
48 changes: 27 additions & 21 deletions plugins/aggregators/derivative/README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,47 @@
# Derivative Aggregator Plugin

The Derivative Aggregator Plugin estimates the derivative for all fields of the
aggregated metrics.

### Time Derivatives
## Time Derivatives

In its default configuration it determines the first and last measurement of
the period. From these measurements the time difference in seconds is
calculated. This time difference is than used to divide the difference of each
field using the following formula:
```

```text
field_last - field_first
derivative = --------------------------
time_difference
```

For each field the derivative is emitted with a naming pattern
`<fieldname>_rate`.

### Custom Derivation Variable
## Custom Derivation Variable

The plugin supports to use a field of the aggregated measurements as derivation
variable in the denominator. This variable is assumed to be a monotonically
increasing value. In this feature the following formula is used:
```

```text
field_last - field_first
derivative = --------------------------------
variable_last - variable_first
```

**Make sure the specified variable is not filtered and exists in the metrics passed to this aggregator!**

When using a custom derivation variable, you should change the `suffix` of the derivative name.
When using a custom derivation variable, you should change the `suffix` of the derivative name.
See the next section on [customizing the derivative name](#customize-the-derivative-name) for details.

### Customize the Derivative Name
## Customize the Derivative Name

The derivatives generated by the aggregator are named `<fieldname>_rate`, i.e. they are composed of the field name and a suffix `_rate`.
You can configure the suffix to be used by changing the `suffix` parameter.

### Roll-Over to next Period
## Roll-Over to next Period

Calculating the derivative for a period requires at least two distinct measurements during that period.
Whether those are available depends on the configuration of the aggregator `period` and the agent `interval`.
Expand All @@ -47,7 +52,7 @@ replace the roll-over metric. A main benefit of this roll-over is the ability to
cope with multiple "quiet" periods, where no new measurement is pushed to the
aggregator. The roll-over will take place at most `max_roll_over` times.

#### Example of Roll-Over
### Example of Roll-Over

Let us assume we have an input plugin, that generates a measurement with a single metric "test" every 2 seconds.
Let this metric increase the first 10 seconds from 0.0 to 10.0 and then decrease the next 10 seconds form 10.0 to 0.0:
Expand Down Expand Up @@ -111,26 +116,26 @@ To illustrate this, let us compare the derivatives for `period = "7s"`.
| timestamp | value | `max_roll_over = 0` | `max_roll_over = 1` |
|-----------|-------|-----------|--------------|
| 0 | 0.0 |
| 2 | 2.0 |
| 4 | 4.0 |
| 6 | 6.0 |
| 2 | 2.0 |
| 4 | 4.0 |
| 6 | 6.0 |
||| 1.0 | 1.0 |
| 8 | 8.0 |
| 10 | 10.0 |
| 12 | 8.0 |
||| 0.0 | 0.33... |
| 14 | 6.0 |
| 10 | 10.0 |
| 12 | 8.0 |
||| 0.0 | 0.33... |
| 14 | 6.0 |
| 16 | 4.0 |
| 18 | 2.0 |
| 20 | 0.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 `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 including the gap between the periods.
Using `max_roll_over` with a value greater 0 may be important, if you need to detect changes between periods, e.g. when you have very few measurements in a period or quasi-constant metrics with only occasional changes.

### Configuration
## Configuration

```toml
[[aggregators.derivative]]
Expand All @@ -151,13 +156,14 @@ Using `max_roll_over` with a value greater 0 may be important, if you need to de
period = "30s"
```

### Tags:
### Tags

No tags are applied by this aggregator.
Existing tags are passed throug the aggregator untouched.

### Example Output
## Example Output

```
```text
net bytes_recv=15409i,packets_recv=164i,bytes_sent=16649i,packets_sent=120i 1508843640000000000
net bytes_recv=73987i,packets_recv=364i,bytes_sent=87328i,packets_sent=452i 1508843660000000000
net bytes_recv_by_packets_recv=292.89 1508843660000000000
Expand Down
11 changes: 6 additions & 5 deletions plugins/aggregators/final/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ discrete time series such as procstat, cgroup, kubernetes etc.
When a series has not been updated within the time defined in
`series_timeout`, the last metric is emitted with the `_final` appended.

### Configuration
## Configuration

```toml
[[aggregators.final]]
Expand All @@ -25,20 +25,21 @@ When a series has not been updated within the time defined in
series_timeout = "5m"
```

### Metrics
## Metrics

Measurement and tags are unchanged, fields are emitted with the suffix
`_final`.

### Example Output
## Example Output

```
```text
counter,host=bar i_final=3,j_final=6 1554281635115090133
counter,host=foo i_final=3,j_final=6 1554281635112992012
```

Original input:
```

```text
counter,host=bar i=1,j=4 1554281633101153300
counter,host=foo i=1,j=4 1554281633099323601
counter,host=bar i=2,j=5 1554281634107980073
Expand Down
33 changes: 16 additions & 17 deletions plugins/aggregators/histogram/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ By default bucket counts are not reset between periods and will be non-strictly
increasing while Telegraf is running. This behavior can be changed by setting the
`reset` parameter to true.

#### Design
## Design

Each metric is passed to the aggregator and this aggregator searches
histogram buckets for those fields, which have been specified in the
Expand All @@ -24,7 +24,7 @@ The algorithm of hit counting to buckets was implemented on the base
of the algorithm which is implemented in the Prometheus
[client](https://github.com/prometheus/client_golang/blob/master/prometheus/histogram.go).

### Configuration
## Configuration

```toml
# Configuration for aggregate histogram metrics
Expand Down Expand Up @@ -73,40 +73,39 @@ boundaries. Each float value defines the inclusive upper (right) bound of the b
The `+Inf` bucket is added automatically and does not need to be defined.
(For left boundaries, these specified bucket borders and `-Inf` will be used).

### Measurements & Fields:
## Measurements & Fields

The postfix `bucket` will be added to each field key.

- measurement1
- field1_bucket
- field2_bucket
- field1_bucket
- field2_bucket

### Tags:
### Tags

* `cumulative = true` (default):
* `le`: Right bucket border. It means that the metric value is less than or
- `cumulative = true` (default):
- `le`: Right bucket border. It means that the metric value is less than or
equal to the value of this tag. If a metric value is sorted into a bucket,
it is also sorted into all larger buckets. As a result, the value of
`<field>_bucket` is rising with rising `le` value. When `le` is `+Inf`,
the bucket value is the count of all metrics, because all metric values are
less than or equal to positive infinity.
* `cumulative = false`:
* `gt`: Left bucket border. It means that the metric value is greater than
- `cumulative = false`:
- `gt`: Left bucket border. It means that the metric value is greater than
(and not equal to) the value of this tag.
* `le`: Right bucket border. It means that the metric value is less than or
- `le`: Right bucket border. It means that the metric value is less than or
equal to the value of this tag.
* As both `gt` and `le` are present, each metric is sorted in only exactly
one bucket.
- As both `gt` and `le` are present, each metric is sorted in only exactly
one bucket.


### Example Output:
## Example Output

Let assume we have the buckets [0, 10, 50, 100] and the following field values
for `usage_idle`: [50, 7, 99, 12]

With `cumulative = true`:

```
```text
cpu,cpu=cpu1,host=localhost,le=0.0 usage_idle_bucket=0i 1486998330000000000 # none
cpu,cpu=cpu1,host=localhost,le=10.0 usage_idle_bucket=1i 1486998330000000000 # 7
cpu,cpu=cpu1,host=localhost,le=50.0 usage_idle_bucket=2i 1486998330000000000 # 7, 12
Expand All @@ -116,7 +115,7 @@ cpu,cpu=cpu1,host=localhost,le=+Inf usage_idle_bucket=4i 1486998330000000000 #

With `cumulative = false`:

```
```text
cpu,cpu=cpu1,host=localhost,gt=-Inf,le=0.0 usage_idle_bucket=0i 1486998330000000000 # none
cpu,cpu=cpu1,host=localhost,gt=0.0,le=10.0 usage_idle_bucket=1i 1486998330000000000 # 7
cpu,cpu=cpu1,host=localhost,gt=10.0,le=50.0 usage_idle_bucket=1i 1486998330000000000 # 12
Expand Down
4 changes: 2 additions & 2 deletions plugins/aggregators/merge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Use this plugin when fields are split over multiple metrics, with the same
measurement, tag set and timestamp. By merging into a single metric they can
be handled more efficiently by the output.

### Configuration
## Configuration

```toml
[[aggregators.merge]]
Expand All @@ -16,7 +16,7 @@ be handled more efficiently by the output.
drop_original = true
```

### Example
## Example

```diff
- cpu,host=localhost usage_time=42 1567562620000000000
Expand Down
14 changes: 7 additions & 7 deletions plugins/aggregators/minmax/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The minmax aggregator plugin aggregates min & max values of each field it sees,
emitting the aggrate every `period` seconds.

### Configuration:
## Configuration

```toml
# Keep the aggregate min/max of each metric passing through.
Expand All @@ -16,19 +16,19 @@ emitting the aggrate every `period` seconds.
drop_original = false
```

### Measurements & Fields:
## Measurements & Fields

- measurement1
- field1_max
- field1_min
- field1_max
- field1_min

### Tags:
## Tags

No tags are applied by this aggregator.

### Example Output:
## Example Output

```
```shell
$ telegraf --config telegraf.conf --quiet
system,host=tars load1=1.72 1475583980000000000
system,host=tars load1=1.6 1475583990000000000
Expand Down
Loading

0 comments on commit 96e939a

Please sign in to comment.