use of com.netflix.hystrix.HystrixThreadPoolMetrics 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);
}
}
use of com.netflix.hystrix.HystrixThreadPoolMetrics 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;
}
Aggregations