Skip to content

Commit

Permalink
Support stop in aggregate section without send to.
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Bowman <[email protected]>
  • Loading branch information
cbowman0 committed Sep 27, 2024
1 parent 7b8ddf9 commit be171df
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ CRTESTS = \
issue357 \
issue369 \
issue448 \
issue461 \
server-type \
basic \
metriclimits \
Expand Down
2 changes: 1 addition & 1 deletion conffile.l
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ match {
return crTO;
}
<idcl>blackhole return crBLACKHOLE;
<ma,idcl>stop return crSTOP;
<ma,idcl,ag>stop return crSTOP;

rewrite {
identstate = re;
Expand Down
24 changes: 24 additions & 0 deletions issues/issue461.conf
Original file line number Diff line number Diff line change
@@ -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
;
42 changes: 42 additions & 0 deletions test/issue461.out
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions test/issue461.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
collectd.test_host.cpu.42.percent.idle
collectd.test_host2.cpu.42.percent.idle

0 comments on commit be171df

Please sign in to comment.