Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clarify the relationship between where, where-event, and match.
(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.
- Loading branch information
Showing
2 changed files
with
84 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters