Convenience class that makes it easier to log values in a histogram-like fashion.
Values are automatically grouped into ranges/"bins" of similar values; the width of the
"bins" into which values are grouped can be specified by the constructor parameter "factor".
New values are divided by the given factor in order to determine the bin in which the
value should be counted, e.g. if you construct a HistogramLikeValue with a factor of "1000"
and add the following values
) rather
than grouped into separate bins as specified by "factor".
The "bins" are not sized automatically because this would require storing all added
values so that the bin values could be re-calculated.
The HistogramLikeValue automatically creates counter and timer values in the background;
the names of these Reportables are constructed using the "baseName" specified as
constructor argument. In the end, the following InApplicationMonitor reportables are created
by this class:
<basename>.total Timer recording all values
<basename>.biggerThan<value> Counter for each bin that is created
<basename>.currentMax StateValue holding the current maximum value
- Author:
- ptraeder
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NAME_BIGGER_THAN
public static final String NAME_BIGGER_THAN
- See Also:
- Constant Field Values
NAME_FACTOR
public static final String NAME_FACTOR
- See Also:
- Constant Field Values
NAME_CURRENT_MAX
public static final String NAME_CURRENT_MAX
- See Also:
- Constant Field Values
baseName
private String baseName
timerName
private String timerName
factorName
private String factorName
factor
private long factor
maxLimit
private long maxLimit
currentMaxValue
private long currentMaxValue
maxValueName
private String maxValueName
maxLimitName
private String maxLimitName
HistogramLikeValue
public HistogramLikeValue(String baseName,
long factor)
- Parameters:
baseName - the base name to use for InApplicationMonitor value namefactor - the factor to divide new values by in order to group them into bins
HistogramLikeValue
public HistogramLikeValue(String baseName,
long factor,
long maxLimit)
- Parameters:
baseName - the base name to use for InApplicationMonitor value namefactor - the factor to divide new values by in order to group them into binsmaxLimit - the upper limit up to which bins are created - all values bigger than maxLimit are grouped into one single bin
getBaseName
public String getBaseName()
getBinName
private String getBinName(long value)
addValue
public void addValue(long newValue)
- adds a new value to the InApplicationMonitor, grouping it into the appropriate bin.
- Parameters:
newValue - the value that should be added
Copyright © 2013 Immobilien Scout GmbH. All Rights Reserved.