From 9bd070587588a7abb2d5285f8cf00281279e5cb0 Mon Sep 17 00:00:00 2001 From: Thomas Roehl Date: Wed, 4 May 2022 14:32:07 +0200 Subject: [PATCH] Add order of operations in router to README --- internal/metricRouter/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/internal/metricRouter/README.md b/internal/metricRouter/README.md index ea5469d..3344376 100644 --- a/internal/metricRouter/README.md +++ b/internal/metricRouter/README.md @@ -174,6 +174,7 @@ This option takes a list of evaluable conditions and performs them one after the ``` The first line is comparable with the example in `drop_metrics`, it drops all metrics starting with `drop_metric_` and ending with a number. The second line drops all metrics of the first hardware thread (**not** recommended) +# Manipulating the metric units ## The `normalize_units` option The cc-metric-collector tries to read the data from the system as it is reported. If available, it tries to read the metric unit from the system as well (e.g. from `/proc/meminfo`). The problem is that, depending on the source, the metric units are named differently. Just think about `byte`, `Byte`, `B`, `bytes`, ... @@ -228,3 +229,22 @@ Use cases for `interval_aggregates`: } } ``` + +# Order of operations + +The router performs the above mentioned options in a specific order. In order to get the logic you want for a specific metric, it is crucial to know the processing order: + +- Add the `hostname` tag (c) +- Manipulate the timestamp to the interval timestamp (c,r) +- Drop metrics based on `drop_metrics` and `drop_metrics_if` (c,r) +- Add tags based on `add_tags` (c,r) +- Delete tags based on `del_tags` (c,r) +- Rename metric based on `rename_metric` (c,r) + - Add tags based on `add_tags` to still work if the configuration uses the new name (c,r) + - Delete tags based on `del_tags` to still work if the configuration uses the new name (c,r) +- Normalize units when `normalize_units` is set (c,r) +- Convert unit prefix based on `change_unit_prefix` (c,r) + +Legend: +- 'c' if metric is coming from a collector +- 'r' if metric is coming from a receiver \ No newline at end of file