From a268dc6e389f4d3f34b2295a32d78b81a97a8ba9 Mon Sep 17 00:00:00 2001 From: Christopher Bowman Date: Fri, 27 Sep 2024 16:24:47 -0400 Subject: [PATCH] Support stop in aggregate section without send to. Signed-off-by: Christopher Bowman --- ChangeLog.md | 2 ++ Makefile.am | 1 + conffile.l | 2 +- issues/issue461.conf | 24 ++++++++++++++++++++++++ test/issue461.out | 42 ++++++++++++++++++++++++++++++++++++++++++ test/issue461.tst | 2 ++ 6 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 issues/issue461.conf create mode 100644 test/issue461.out create mode 100644 test/issue461.tst diff --git a/ChangeLog.md b/ChangeLog.md index b523f74a..15055667 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,6 +4,8 @@ * [PR #463](https://github.com/grobian/carbon-c-relay/pull/463) support rewrite form \g{n} to allow for integers to follow expansion +* [PR #464](https://github.com/grobian/carbon-c-relay/pull/464) + support stop in aggregate section without send to ### Bugfixes diff --git a/Makefile.am b/Makefile.am index d95f821c..2f29bbd5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -126,6 +126,7 @@ CRTESTS = \ issue357 \ issue369 \ issue448 \ + issue461 \ issue462 \ server-type \ basic \ diff --git a/conffile.l b/conffile.l index 55881352..8cae1576 100644 --- a/conffile.l +++ b/conffile.l @@ -125,7 +125,7 @@ match { return crTO; } blackhole return crBLACKHOLE; -stop return crSTOP; +stop return crSTOP; rewrite { identstate = re; diff --git a/issues/issue461.conf b/issues/issue461.conf new file mode 100644 index 00000000..de9d79e4 --- /dev/null +++ b/issues/issue461.conf @@ -0,0 +1,24 @@ +cluster default + fnv1a_ch replication 1 + 127.0.0.1:2103 proto tcp + ; + +# metric name reported by collectd: collectd.$hostname.cpu.$core-id.percent.$type +# aggregate target metric name: collectd.$hostname.aggregated.cpu.total_cores +aggregate + ^collectd\.(.+)\.cpu\.([0-9]+)\.percent\.idle + ^collectd\.(ABC-.+)\.cpu\.([0-9]+)\.percent\.idle + ^collectd\.ABC-(.+)\.cpu\.([0-9]+)\.percent\.idle + ^collectd\.([^.]+)\.cpu\.([0-9]+)\.percent\.idle + every 10 seconds + expire after 15 seconds + compute count write to + collectd.\1.aggregated.cpu.total_cores + stop + ; + +match * + send to + default + stop + ; diff --git a/test/issue461.out b/test/issue461.out new file mode 100644 index 00000000..e02cd7b5 --- /dev/null +++ b/test/issue461.out @@ -0,0 +1,42 @@ +listen + type linemode + 2003 proto tcp + 2003 proto udp + /tmp/.s.carbon-c-relay.2003 proto unix + ; + +statistics + submit every 60 seconds + prefix with carbon.relays.test_hostname + ; + +cluster default + fnv1a_ch replication 1 + 127.0.0.1:2103 + ; + +aggregate + ^collectd\.(.+)\.cpu\.([0-9]+)\.percent\.idle + ^collectd\.(ABC-.+)\.cpu\.([0-9]+)\.percent\.idle + ^collectd\.ABC-(.+)\.cpu\.([0-9]+)\.percent\.idle + ^collectd\.([^.]+)\.cpu\.([0-9]+)\.percent\.idle + every 10 seconds + expire after 15 seconds + timestamp at end of bucket + compute count write to + collectd.\1.aggregated.cpu.total_cores + stop + ; +match * + send to default + stop + ; + +aggregation + ^collectd\.(.+)\.cpu\.([0-9]+)\.percent\.idle (regex) -> collectd.test_host.cpu.42.percent.idle + count(collectd.\1.aggregated.cpu.total_cores) -> collectd.test_host.aggregated.cpu.total_cores + stop +aggregation + ^collectd\.(.+)\.cpu\.([0-9]+)\.percent\.idle (regex) -> collectd.test_host2.cpu.42.percent.idle + count(collectd.\1.aggregated.cpu.total_cores) -> collectd.test_host2.aggregated.cpu.total_cores + stop diff --git a/test/issue461.tst b/test/issue461.tst new file mode 100644 index 00000000..f485246f --- /dev/null +++ b/test/issue461.tst @@ -0,0 +1,2 @@ +collectd.test_host.cpu.42.percent.idle +collectd.test_host2.cpu.42.percent.idle