Skip to content

Commit

Permalink
Add Javadoc for HystrixMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Jacobs committed Jul 28, 2015
1 parent a46b6e9 commit f13314a
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions hystrix-core/src/main/java/com/netflix/hystrix/HystrixMetrics.java
Expand Up @@ -19,14 +19,16 @@

/**
* Abstract base class for Hystrix metrics
*
* Read methods are public, as they may get called by arbitrary metrics consumers in other projects
* Write methods are protected, so that only internals may trigger them.
*/
public abstract class HystrixMetrics {

/**
* Get the cumulative count since the start of the application for the given {@link HystrixRollingNumberEvent}.
*
* @param event
* {@link HystrixRollingNumberEvent} of the event to retrieve a sum for
* @param event {@link HystrixRollingNumberEvent} of the event to retrieve a sum for
* @return long cumulative count
*/
public abstract long getCumulativeCount(HystrixRollingNumberEvent event);
Expand All @@ -36,17 +38,42 @@ public abstract class HystrixMetrics {
* <p>
* The rolling window is defined by {@link HystrixCommandProperties#metricsRollingStatisticalWindowInMilliseconds()}.
*
* @param event
* {@link HystrixRollingNumberEvent} of the event to retrieve a sum for
* @param event {@link HystrixRollingNumberEvent} of the event to retrieve a sum for
* @return long rolling count
*/
public abstract long getRollingCount(HystrixRollingNumberEvent event);

/**
* Get the rolling max for the given {@link HystrixRollingNumberEvent}. This number is the high-water mark
* that the metric has observed in the rolling window.
* <p>
* The rolling window is defined by {@link HystrixCommandProperties#metricsRollingStatisticalWindowInMilliseconds()}.
*
* @param event {@link HystrixRollingNumberEvent} of the event to retrieve a rolling max for
* @return long rolling max
*/
public abstract long getRollingMax(HystrixRollingNumberEvent event);

/**
* Increment the count of an {@link HystrixRollingNumberEvent}.
*
* @param event event type to increment
*/
protected abstract void addEvent(HystrixRollingNumberEvent event);

/**
* Add a count of {@link HystrixRollingNumberEvent}s
*
* @param event event type to add to
* @param value count to add
*/
protected abstract void addEventWithValue(HystrixRollingNumberEvent event, long value);

/**
* Set the observed value of a {@link HystrixRollingNumberEvent} into a counter that keeps track of maximum values
*
* @param event event type to observe count of
* @param value count observed
*/
protected abstract void updateRollingMax(HystrixRollingNumberEvent event, long value);

protected abstract long getRollingMax(HystrixRollingNumberEvent event);
}

0 comments on commit f13314a

Please sign in to comment.