Subscription actionSubscription = Observable.timer(0, interval, TimeUnit.MILLISECONDS, Schedulers.computation())
.subscribe(new Action1<Long>() {
@Override
public void call(Long tick) {
if (!response.getChannelHandlerContext().channel().isOpen()) {
subscription.unsubscribe();
return;
}
try {
for (HystrixCommandMetrics commandMetrics : HystrixCommandMetrics.getInstances()) {
writeMetric(toJson(commandMetrics), response);