refactor riemann send function