Skip to content

Commit

Permalink
Merge pull request #30 from benjchristensen/simplified-metrics-access
Browse files Browse the repository at this point in the history
Simplified access to HystrixCommandMetrics
  • Loading branch information
benjchristensen committed Nov 30, 2012
2 parents 8e4c595 + e46b76d commit f0023bb
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class HystrixCommandMetrics {
private static final ConcurrentHashMap<String, HystrixCommandMetrics> metrics = new ConcurrentHashMap<String, HystrixCommandMetrics>();

/**
* Get the {@link HystrixCommandMetrics} instance for a given {@link HystrixCommandKey}.
* Get or create the {@link HystrixCommandMetrics} instance for a given {@link HystrixCommandKey}.
* <p>
* This is thread-safe and ensures only 1 {@link HystrixCommandMetrics} per {@link HystrixCommandKey}.
*
Expand Down Expand Up @@ -82,6 +82,17 @@ public static HystrixCommandMetrics getInstance(HystrixCommandKey key, HystrixCo
}
}

/**
* Get the {@link HystrixCommandMetrics} instance for a given {@link HystrixCommandKey} or null if one does not exist.
*
* @param key
* {@link HystrixCommandKey} of {@link HystrixCommand} instance requesting the {@link HystrixCommandMetrics}
* @return {@link HystrixCommandMetrics}
*/
public static HystrixCommandMetrics getInstance(HystrixCommandKey key) {
return metrics.get(key.name());
}

private final HystrixCommandProperties properties;
private final HystrixRollingNumber counter;
private final HystrixRollingPercentile percentileExecution;
Expand Down

0 comments on commit f0023bb

Please sign in to comment.