Skip to content

Commit

Permalink
Using hystrix-data-stream for hystrix-rx-entty-metrics-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Jacobs committed Jun 22, 2016
1 parent 5370e7b commit d6dc182
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 379 deletions.
3 changes: 1 addition & 2 deletions hystrix-contrib/hystrix-rx-netty-metrics-stream/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
dependencies {
compile project(':hystrix-core')
compile project(':hystrix-data-stream')
compile 'io.reactivex:rxnetty:0.4.12'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.2'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.2'
testCompile 'junit:junit-dep:4.10'
testCompile 'org.powermock:powermock-easymock-release-full:1.5.5'
testCompile 'org.easymock:easymock:3.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.netflix.hystrix.HystrixCollapserMetrics;
import com.netflix.hystrix.HystrixCommandMetrics;
import com.netflix.hystrix.HystrixThreadPoolMetrics;
import com.netflix.hystrix.serial.SerialHystrixDashboardData;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
Expand All @@ -34,8 +35,6 @@
import java.nio.charset.Charset;
import java.util.concurrent.TimeUnit;

import static com.netflix.hystrix.contrib.rxnetty.metricsstream.JsonMappers.*;

/**
* Streams Hystrix metrics in Server Sent Event (SSE) format. RxNetty application handlers shall
* be wrapped by this handler. It transparently intercepts HTTP requests at a configurable path
Expand Down Expand Up @@ -96,13 +95,13 @@ public void call(Long tick) {
}
try {
for (HystrixCommandMetrics commandMetrics : HystrixCommandMetrics.getInstances()) {
writeMetric(toJson(commandMetrics), response);
writeMetric(SerialHystrixDashboardData.toJsonString(commandMetrics), response);
}
for (HystrixThreadPoolMetrics threadPoolMetrics : HystrixThreadPoolMetrics.getInstances()) {
writeMetric(toJson(threadPoolMetrics), response);
writeMetric(SerialHystrixDashboardData.toJsonString(threadPoolMetrics), response);
}
for (HystrixCollapserMetrics collapserMetrics : HystrixCollapserMetrics.getInstances()) {
writeMetric(toJson(collapserMetrics), response);
writeMetric(SerialHystrixDashboardData.toJsonString(collapserMetrics), response);
}
} catch (Exception e) {
subject.onError(e);
Expand Down
Loading

0 comments on commit d6dc182

Please sign in to comment.