dkern / node-red-counter

A Node-RED node to increment a count.
Other
8 stars 9 forks source link

Per topic counter #16

Open berkovskyy opened 4 years ago

berkovskyy commented 4 years ago

It would be great to have counter working on a per topic basis (similar to rbe node). Example use case would be counting number of failures from ping node.

dkern commented 4 years ago

I'm not sure if this is worth implementing it and if this is a good idea. There could possible an endless amount of topics to store. If you want to count on a single topic, put a topic filtering node in front of it, so you only count the messages you want to. That is pretty easy and can be customize by everyone on it's own. I think that it the best approach.

berkovskyy commented 4 years ago

Filtering approach won't work in many cases. In my particular one I am checking connectivity to 20+ hosts by triggering ping node with list of ip addresses which is formed dynamically. The ping node emits a message per host with the message containing result of ping and "topic" set to ip address. I am looking to count number of failed pings per host and trigger different actions accordingly.

dkern commented 4 years ago

I understand what you want to do. Actually, i think the node one would be still the wrong node to use here imo. That would be a better job for a throttle node. But to be honest, it didn't support topics as well. ;) But i think i would rather implement a topic split in the throttle node, than in the counter node. I think it makes more sense ...