Package org.apache.jackrabbit.stats
Class TimeSeriesRecorder
java.lang.Object
org.apache.jackrabbit.stats.TimeSeriesRecorder
- All Implemented Interfaces:
TimeSeries
Recorder of a time series. An instance of this class records (and clears)
the state of a given
AtomicLong
counter once every second and
exposes the collected time series through the TimeSeries
interface.-
Constructor Summary
ConstructorsConstructorDescriptionTimeSeriesRecorder
(boolean resetValueEachSecond) Same asTimeSeriesRecorder(boolean, long)
passing long for the 2nd argumentTimeSeriesRecorder
(boolean resetValueEachSecond, long missingValue) -
Method Summary
Modifier and TypeMethodDescriptionReturns theAtomicLong
instance used to measure the value for the time series.long
The value used to encode missing values i.e.long[]
Returns the measured value per hour over the last week.long[]
Returns the measured value per minute over the last hour.long[]
Returns the measured value per second over the last minute.long[]
Returns the measured value per week over the last three years.void
Records the number of measured values over the past second and resets the counter.
-
Constructor Details
-
TimeSeriesRecorder
-
TimeSeriesRecorder
public TimeSeriesRecorder(boolean resetValueEachSecond) Same asTimeSeriesRecorder(boolean, long)
passing long for the 2nd argument- Parameters:
resetValueEachSecond
- Whether to reset value each second
-
TimeSeriesRecorder
public TimeSeriesRecorder(boolean resetValueEachSecond, long missingValue) - Parameters:
resetValueEachSecond
- Whether to reset value each secondmissingValue
- The value used to encode missing values
-
-
Method Details
-
getCounter
Returns theAtomicLong
instance used to measure the value for the time series.- Returns:
- value
-
recordOneSecond
public void recordOneSecond()Records the number of measured values over the past second and resets the counter. This method should be scheduled to be called once per second. -
getMissingValue
public long getMissingValue()Description copied from interface:TimeSeries
The value used to encode missing values i.e. for a period where no value was recorded.- Specified by:
getMissingValue
in interfaceTimeSeries
- Returns:
- default value
-
getValuePerSecond
public long[] getValuePerSecond()Description copied from interface:TimeSeries
Returns the measured value per second over the last minute.- Specified by:
getValuePerSecond
in interfaceTimeSeries
- Returns:
- measured value per second, in chronological order
-
getValuePerMinute
public long[] getValuePerMinute()Description copied from interface:TimeSeries
Returns the measured value per minute over the last hour.- Specified by:
getValuePerMinute
in interfaceTimeSeries
- Returns:
- measured value per minute, in chronological order
-
getValuePerHour
public long[] getValuePerHour()Description copied from interface:TimeSeries
Returns the measured value per hour over the last week.- Specified by:
getValuePerHour
in interfaceTimeSeries
- Returns:
- measured value per hour, in chronological order
-
getValuePerWeek
public long[] getValuePerWeek()Description copied from interface:TimeSeries
Returns the measured value per week over the last three years.- Specified by:
getValuePerWeek
in interfaceTimeSeries
- Returns:
- measured value per week, in chronological order
-