…s nicely under supervisor, etc
(where expr) rewrites expr in complex ways, as well as binding symbols like 'event, 'metric, and 'state. In cases where you want to write a predicate without symbol capture, (where-event event-name expr) allowed you to bind the event to an arbitrary symbol inside expr. We already have a system for binding variables in scope: function arguments. We also have a large library of functions which take events and return truthy values. It made sense to consolidate these two into a new stream: (where* f), which takes a *function* of an event instead of an expression. (where*) does not rewrite its arguments, except to provide (where)'s (else ...) blocks. (where-event) is gone; (where*) provides all its functionality in a more composable way. (match) has been underappreciated for a while now. I've made it more powerful by using the new Match protocol in riemann.common, which allows it to apply functions, regexes, sets, and values as predicates for matching aspects of an event. It should be a solid complement to (where) with these changes.
Their documentation lied! Now, (tagged-all "cat" prn) works the same as (tagged-all ["cat"] prn).
(where used to work like (when), passing events which matched predicate to each child and doing nothing when events did not match. Now, children inside one (or more) expressions wrapped in (else) receive events which *do not* match predicate. For instance: (where (metric < 500) (with :state "ok" index) (else (with :state "warning" index) (email "firstname.lastname@example.org")))
This lets it match regular expressions, functions, and objects against events efficiently at runtime instead of compile-time. This allows the use of variables in where predicates.
There's some sort of errror that only manifests on travis-ci; hoping this extra assertion will help figure it out.
This should fix the reconnection and liveness issues with the old socket system and provide the higher throughput of the arrayblockingqueue-of-sockets implementation. Also makes the code much simpler. Tests with graphite, both automated and live, show resilience to transient and long-running failures, including flapping.