I think you can dramatically simplify this by using https://github.com/aphyr/riemann/blob/master/src/riemann/streams.clj#L525