Search in sources :

Example 1 with HystrixCollapserMetrics

use of com.netflix.hystrix.HystrixCollapserMetrics in project Hystrix by Netflix.

the class SerialHystrixDashboardData method writeDashboardData.

private static void writeDashboardData(JsonGenerator json, HystrixDashboardStream.DashboardData dashboardData) {
    try {
        json.writeStartArray();
        for (HystrixCommandMetrics commandMetrics : dashboardData.getCommandMetrics()) {
            writeCommandMetrics(commandMetrics, json);
        }
        for (HystrixThreadPoolMetrics threadPoolMetrics : dashboardData.getThreadPoolMetrics()) {
            writeThreadPoolMetrics(threadPoolMetrics, json);
        }
        for (HystrixCollapserMetrics collapserMetrics : dashboardData.getCollapserMetrics()) {
            writeCollapserMetrics(collapserMetrics, json);
        }
        json.writeEndArray();
        json.close();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : HystrixThreadPoolMetrics(com.netflix.hystrix.HystrixThreadPoolMetrics) HystrixCommandMetrics(com.netflix.hystrix.HystrixCommandMetrics) HystrixCollapserMetrics(com.netflix.hystrix.HystrixCollapserMetrics) IOException(java.io.IOException)

Example 2 with HystrixCollapserMetrics

use of com.netflix.hystrix.HystrixCollapserMetrics in project Hystrix by Netflix.

the class HystrixMetricsStreamHandler method handleHystrixRequest.

private Observable<Void> handleHystrixRequest(final HttpServerResponse<O> response) {
    writeHeaders(response);
    final Subject<Void, Void> subject = PublishSubject.create();
    final MultipleAssignmentSubscription subscription = new MultipleAssignmentSubscription();
    Subscription actionSubscription = Observable.interval(interval, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {

        @Override
        public void call(Long tick) {
            if (!response.getChannel().isOpen()) {
                subscription.unsubscribe();
                return;
            }
            try {
                for (HystrixCommandMetrics commandMetrics : HystrixCommandMetrics.getInstances()) {
                    writeMetric(SerialHystrixDashboardData.toJsonString(commandMetrics), response);
                }
                for (HystrixThreadPoolMetrics threadPoolMetrics : HystrixThreadPoolMetrics.getInstances()) {
                    writeMetric(SerialHystrixDashboardData.toJsonString(threadPoolMetrics), response);
                }
                for (HystrixCollapserMetrics collapserMetrics : HystrixCollapserMetrics.getInstances()) {
                    writeMetric(SerialHystrixDashboardData.toJsonString(collapserMetrics), response);
                }
            } catch (Exception e) {
                subject.onError(e);
            }
        }
    });
    subscription.set(actionSubscription);
    return subject;
}
Also used : HystrixThreadPoolMetrics(com.netflix.hystrix.HystrixThreadPoolMetrics) MultipleAssignmentSubscription(rx.subscriptions.MultipleAssignmentSubscription) Subscription(rx.Subscription) HystrixCommandMetrics(com.netflix.hystrix.HystrixCommandMetrics) HystrixCollapserMetrics(com.netflix.hystrix.HystrixCollapserMetrics) MultipleAssignmentSubscription(rx.subscriptions.MultipleAssignmentSubscription)

Aggregations

HystrixCollapserMetrics (com.netflix.hystrix.HystrixCollapserMetrics)2 HystrixCommandMetrics (com.netflix.hystrix.HystrixCommandMetrics)2 HystrixThreadPoolMetrics (com.netflix.hystrix.HystrixThreadPoolMetrics)2 IOException (java.io.IOException)1 Subscription (rx.Subscription)1 MultipleAssignmentSubscription (rx.subscriptions.MultipleAssignmentSubscription)1