Skip to content

Instantly share code, notes, and snippets.

@benjchristensen
Last active December 16, 2015 21:21
Show Gist options
  • Save benjchristensen/5499195 to your computer and use it in GitHub Desktop.
Save benjchristensen/5499195 to your computer and use it in GitHub Desktop.
Hystrix Dashboard Event Stream

Example output of hystrix.stream that is consumed by the dashboard: https://github.com/Netflix/Hystrix/tree/master/hystrix-dashboard

The stream is an EventSource formatted stream of JSON: https://developer.mozilla.org/en-US/docs/Server-sent_events/EventSource

Content-Type: text/event-stream;charset=UTF-8

The b_run-hystrix-examples-webapp.sh file shows how to run the example Hystrix app that exposes a stream to play with.

The c_curl-hystrix-stream.sh file shows how to curl the stream (you must open the app in a browser to trigger activity for the stream to send).

The d_stream.md file shows 2 events from the stream, 1 for "command" and 1 for "threadpool".

You can see all of the fields the UI expects here: https://github.com/Netflix/Hystrix/blob/master/hystrix-dashboard/src/main/webapp/components/hystrixCommand/hystrixCommand.js#L140 and here: https://github.com/Netflix/Hystrix/blob/master/hystrix-dashboard/src/main/webapp/components/hystrixThreadPool/hystrixThreadPool.js#L105

$ cd Hystrix.git/hystrix-examples-webapp
:hystrix-examples-webapp $ ../gradlew jettyRun
:hystrix-core:compileJava UP-TO-DATE
:hystrix-core:processResources UP-TO-DATE
:hystrix-core:classes UP-TO-DATE
:hystrix-core:jar UP-TO-DATE
:hystrix-examples:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
:hystrix-examples:processResources UP-TO-DATE
:hystrix-examples:classes
:hystrix-examples:jar
:hystrix-contrib:hystrix-metrics-event-stream:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
:hystrix-contrib:hystrix-metrics-event-stream:processResources UP-TO-DATE
:hystrix-contrib:hystrix-metrics-event-stream:classes
:hystrix-contrib:hystrix-metrics-event-stream:jar
:hystrix-contrib:hystrix-request-servlet:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
:hystrix-contrib:hystrix-request-servlet:processResources UP-TO-DATE
:hystrix-contrib:hystrix-request-servlet:classes
:hystrix-contrib:hystrix-request-servlet:jar
:hystrix-examples-webapp:compileJava UP-TO-DATE
:hystrix-examples-webapp:processResources UP-TO-DATE
:hystrix-examples-webapp:classes UP-TO-DATE
:hystrix-examples-webapp:jettyRun
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
> Building > :hystrix-examples-webapp:jettyRun > Running at http://localhost:8989/hystrix-examples-webapp
$ curl http://localhost:8989/hystrix-examples-webapp/hystrix.stream

Example "command" JSON

data: {"type":"HystrixCommand","name":"CreditCardCommand","group":"CreditCard","currentTime":1367450940069,"isCircuitBreakerOpen":false,"errorPercentage":0,"errorCount":0,"requestCount":0,"rollingCountCollapsedRequests":0,"rollingCountExceptionsThrown":0,"rollingCountFailure":0,"rollingCountFallbackFailure":0,"rollingCountFallbackRejection":0,"rollingCountFallbackSuccess":0,"rollingCountResponsesFromCache":0,"rollingCountSemaphoreRejected":0,"rollingCountShortCircuited":0,"rollingCountSuccess":0,"rollingCountThreadPoolRejected":0,"rollingCountTimeout":0,"currentConcurrentExecutionCount":0,"latencyExecute_mean":1448,"latencyExecute":{"0":1448,"25":1448,"50":1448,"75":1448,"90":1448,"95":1448,"99":1448,"99.5":1448,"100":1448},"latencyTotal_mean":1448,"latencyTotal":{"0":1448,"25":1448,"50":1448,"75":1448,"90":1448,"95":1448,"99":1448,"99.5":1448,"100":1448},"propertyValue_circuitBreakerRequestVolumeThreshold":20,"propertyValue_circuitBreakerSleepWindowInMilliseconds":5000,"propertyValue_circuitBreakerErrorThresholdPercentage":50,"propertyValue_circuitBreakerForceOpen":false,"propertyValue_circuitBreakerForceClosed":false,"propertyValue_circuitBreakerEnabled":true,"propertyValue_executionIsolationStrategy":"THREAD","propertyValue_executionIsolationThreadTimeoutInMilliseconds":3000,"propertyValue_executionIsolationThreadInterruptOnTimeout":true,"propertyValue_executionIsolationThreadPoolKeyOverride":null,"propertyValue_executionIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_metricsRollingStatisticalWindowInMilliseconds":10000,"propertyValue_requestCacheEnabled":true,"propertyValue_requestLogEnabled":true,"reportingHosts":1}

Example "threadpool" JSON

data: {"type":"HystrixThreadPool","name":"PaymentInformation","currentTime":1367450940074,"currentActiveCount":0,"currentCompletedTaskCount":1,"currentCorePoolSize":8,"currentLargestPoolSize":1,"currentMaximumPoolSize":8,"currentPoolSize":1,"currentQueueSize":0,"currentTaskCount":1,"rollingCountThreadsExecuted":0,"rollingMaxActiveThreads":0,"propertyValue_queueSizeRejectionThreshold":5,"propertyValue_metricsRollingStatisticalWindowInMilliseconds":10000,"reportingHosts":1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment