2019-05-16 05:46:28 +08:00
|
|
|
# Final Aggregator Plugin
|
|
|
|
|
|
|
|
|
|
The final aggregator emits the last metric of a contiguous series. A
|
|
|
|
|
contiguous series is defined as a series which receives updates within the
|
|
|
|
|
time period in `series_timeout`. The contiguous series may be longer than the
|
|
|
|
|
time interval defined by `period`.
|
|
|
|
|
|
|
|
|
|
This is useful for getting the final value for data sources that produce
|
|
|
|
|
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.
|
|
|
|
|
|
2022-10-27 03:58:36 +08:00
|
|
|
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
|
|
|
|
|
|
|
|
|
In addition to the plugin-specific configuration settings, plugins support
|
|
|
|
|
additional global and plugin configuration settings. These settings are used to
|
|
|
|
|
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
|
|
|
|
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
|
|
|
|
|
2023-01-12 23:55:21 +08:00
|
|
|
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
2022-10-27 03:58:36 +08:00
|
|
|
|
2021-11-25 02:45:12 +08:00
|
|
|
## Configuration
|
2019-05-16 05:46:28 +08:00
|
|
|
|
2022-05-26 00:25:51 +08:00
|
|
|
```toml @sample.conf
|
2022-04-07 04:40:17 +08:00
|
|
|
# Report the final metric of a series
|
2019-05-16 05:46:28 +08:00
|
|
|
[[aggregators.final]]
|
|
|
|
|
## The period on which to flush & clear the aggregator.
|
|
|
|
|
period = "30s"
|
|
|
|
|
## If true, the original metric will be dropped by the
|
|
|
|
|
## aggregator and will not get sent to the output plugins.
|
2023-10-13 04:28:10 +08:00
|
|
|
# drop_original = false
|
2019-05-16 05:46:28 +08:00
|
|
|
|
|
|
|
|
## The time that a series is not updated until considering it final.
|
2023-10-13 04:28:10 +08:00
|
|
|
# series_timeout = "5m"
|
|
|
|
|
|
|
|
|
|
## Output strategy, supported values:
|
|
|
|
|
## timeout -- output a metric if no new input arrived for `series_timeout`;
|
|
|
|
|
## useful for filling gaps in input data
|
2024-01-06 05:34:02 +08:00
|
|
|
## periodic -- output the last received metric every `period`; useful to
|
2023-10-13 04:28:10 +08:00
|
|
|
## downsample the input data
|
|
|
|
|
# output_strategy = "timeout"
|
2019-05-16 05:46:28 +08:00
|
|
|
```
|
|
|
|
|
|
2023-10-13 04:28:10 +08:00
|
|
|
### Output strategy
|
|
|
|
|
|
|
|
|
|
By default (`output_strategy = "timeout"`) the plugin will only emit a metric
|
|
|
|
|
for the period if the last received one is older than the series_timeout. This
|
|
|
|
|
will not guarantee a regular output of a `final` metric e.g. if the
|
|
|
|
|
series-timeout is a multiple of the gathering interval for an input. In this
|
|
|
|
|
case metric sporadically arrive in the timeout phase of the period and emitting
|
2024-01-06 05:34:02 +08:00
|
|
|
the `final` metric is suppressed.
|
2023-10-13 04:28:10 +08:00
|
|
|
This can be helpful to fill in gaps in the data if no input arrived in time.
|
|
|
|
|
|
|
|
|
|
Contrary to this, `output_strategy = "periodic"` will always output a `final`
|
|
|
|
|
metric at the end of the period irrespectively of when the last metric arrived,
|
2024-01-06 05:34:02 +08:00
|
|
|
the `series_timeout` is ignored.
|
2023-10-13 04:28:10 +08:00
|
|
|
This is helpful if you for example want to downsample input data arriving at a
|
|
|
|
|
high rate and require a periodic output of the `final` metric.
|
|
|
|
|
|
2021-11-25 02:45:12 +08:00
|
|
|
## Metrics
|
2019-05-16 05:46:28 +08:00
|
|
|
|
|
|
|
|
Measurement and tags are unchanged, fields are emitted with the suffix
|
|
|
|
|
`_final`.
|
|
|
|
|
|
2021-11-25 02:45:12 +08:00
|
|
|
## Example Output
|
2019-05-16 05:46:28 +08:00
|
|
|
|
2021-11-25 02:45:12 +08:00
|
|
|
```text
|
2019-05-16 05:46:28 +08:00
|
|
|
counter,host=bar i_final=3,j_final=6 1554281635115090133
|
|
|
|
|
counter,host=foo i_final=3,j_final=6 1554281635112992012
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Original input:
|
2021-11-25 02:45:12 +08:00
|
|
|
|
|
|
|
|
```text
|
2019-05-16 05:46:28 +08:00
|
|
|
counter,host=bar i=1,j=4 1554281633101153300
|
|
|
|
|
counter,host=foo i=1,j=4 1554281633099323601
|
|
|
|
|
counter,host=bar i=2,j=5 1554281634107980073
|
|
|
|
|
counter,host=foo i=2,j=5 1554281634105931116
|
|
|
|
|
counter,host=bar i=3,j=6 1554281635115090133
|
|
|
|
|
counter,host=foo i=3,j=6 1554281635112992012
|
|
|
|
|
```
|