Skip to content

Commit

Permalink
Merge pull request #1034 from mattrjacobs/remove-shortcircuited-from-…
Browse files Browse the repository at this point in the history
…health-counts

Remove SHORT-CIRCUITs from Health check calculation
  • Loading branch information
mattrjacobs committed Jan 4, 2016
2 parents 2cdc352 + a7fc7d1 commit 517813d
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,23 @@ public long getRollingMaxConcurrentExecutions() {

/**
* Retrieve a snapshot of total requests, error count and error percentage.
*
* This metrics should measure the actual health of a {@link HystrixCommand}. For that reason, the following are included:
* <p><ul>
* <li>{@link HystrixRollingNumberEvent#SUCCESS}
* <li>{@link HystrixRollingNumberEvent#FAILURE}
* <li>{@link HystrixRollingNumberEvent#TIMEOUT}
* <li>{@link HystrixRollingNumberEvent#THREAD_POOL_REJECTED}
* <li>{@link HystrixRollingNumberEvent#SEMAPHORE_REJECTED}
* </ul><p>
* The following are not included in either attempts/failures:
* <p><ul>
* <li>{@link HystrixRollingNumberEvent#BAD_REQUEST} - this event denotes bad arguments to the command and not a problem with the command
* <li>{@link HystrixRollingNumberEvent#SHORT_CIRCUITED} - this event measures a health problem in the past, not a problem with the current state
* <li>All Fallback metrics
* <li>{@link HystrixRollingNumberEvent#EMIT} - this event is not a terminal state for the command
* <li>{@link HystrixRollingNumberEvent#COLLAPSED} - this event is about the batching process, not the command execution
* </ul><p>
*
* @return {@link HealthCounts}
*/
Expand All @@ -457,9 +474,8 @@ public HealthCounts getHealthCounts() {
long timeout = counter.getRollingSum(HystrixRollingNumberEvent.TIMEOUT); // fallbacks occur on this
long threadPoolRejected = counter.getRollingSum(HystrixRollingNumberEvent.THREAD_POOL_REJECTED); // fallbacks occur on this
long semaphoreRejected = counter.getRollingSum(HystrixRollingNumberEvent.SEMAPHORE_REJECTED); // fallbacks occur on this
long shortCircuited = counter.getRollingSum(HystrixRollingNumberEvent.SHORT_CIRCUITED); // fallbacks occur on this
long totalCount = failure + success + timeout + threadPoolRejected + shortCircuited + semaphoreRejected;
long errorCount = failure + timeout + threadPoolRejected + shortCircuited + semaphoreRejected;
long totalCount = failure + success + timeout + threadPoolRejected + semaphoreRejected;
long errorCount = failure + timeout + threadPoolRejected + semaphoreRejected;
int errorPercentage = 0;

if (totalCount > 0) {
Expand Down

0 comments on commit 517813d

Please sign in to comment.