Hystrix: Latency and Fault Tolerance for Distributed Systems



com.netflix.hystrix
Class HystrixRequestLog

java.lang.Object
  extended by com.netflix.hystrix.HystrixRequestLog

public class HystrixRequestLog
extends java.lang.Object

Log of HystrixCommand executions and events during the current request.


Method Summary
static HystrixRequestLog getCurrentRequest()
          HystrixRequestLog for current request as defined by HystrixRequestContext.
static HystrixRequestLog getCurrentRequest(HystrixConcurrencyStrategy concurrencyStrategy)
          HystrixRequestLog for current request as defined by HystrixRequestContext.
 java.util.Collection<HystrixCommand<?>> getExecutedCommands()
          Retrieve HystrixCommand instances that were executed during this HystrixRequestContext.
 java.lang.String getExecutedCommandsAsString()
          Formats the log of executed commands into a string usable for logging purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCurrentRequest

public static HystrixRequestLog getCurrentRequest(HystrixConcurrencyStrategy concurrencyStrategy)
HystrixRequestLog for current request as defined by HystrixRequestContext.

Returns:
HystrixRequestLog

getCurrentRequest

public static HystrixRequestLog getCurrentRequest()
HystrixRequestLog for current request as defined by HystrixRequestContext.

NOTE: This uses the default HystrixConcurrencyStrategy or global override. If an injected strategy is being used by commands you must instead use HystrixRequestLog.getCurrentRequest(HystrixConcurrencyStrategy).

Returns:
HystrixRequestLog

getExecutedCommands

public java.util.Collection<HystrixCommand<?>> getExecutedCommands()
Retrieve HystrixCommand instances that were executed during this HystrixRequestContext.

Returns:
Collection<HystrixCommand<?>>

getExecutedCommandsAsString

public java.lang.String getExecutedCommandsAsString()
Formats the log of executed commands into a string usable for logging purposes.

Examples:

If a command has a multiplier such as x4 that means this command was executed 4 times with the same events. The time in milliseconds is the sum of the 4 executions.

For example, TestCommand[SUCCESS][15ms]x4 represents TestCommand being executed 4 times and the sum of those 4 executions was 15ms. These 4 each executed the run() method since RESPONSE_FROM_CACHE was not present as an event.

Returns:
String request log or "Unknown" if unable to instead of throwing an exception.