Class PackedAggregation
java.lang.Object
io.github.resilience4j.core.metrics.PackedAggregation
- All Implemented Interfaces:
CumulativeMeasurement,MeasurementData
A measurement implementation used in sliding windows to track the total duration and the number of calls in the
window, along with the duration and number of calls of the current entry/bucket.
This implementation has the advantage of being cache friendly, benefiting from cache locality when counting/discarding the tracked metrics.
Besides this, metrics can also be quickly cloned, which is important for the lock-free algorithms which are operating with immutable objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the total number of all calls in this measurement.intReturns the number of failed calls in this measurement.intReturns the number of calls in this measurement which were slower than a certain threshold.intReturns the number of failed calls in this measurement which were slower than a certain threshold.longReturns the total duration of all calls in this measurement.voidrecord(long duration, TimeUnit durationUnit, Metrics.Outcome outcome) Records a call duration and its outcome.toString()
-
Constructor Details
-
PackedAggregation
public PackedAggregation() -
PackedAggregation
public PackedAggregation(long[] durations, int[] counts)
-
-
Method Details
-
record
Description copied from interface:CumulativeMeasurementRecords a call duration and its outcome.- Specified by:
recordin interfaceCumulativeMeasurement- Parameters:
duration- the call durationdurationUnit- the time unit of the call durationoutcome- the outcome of the call
-
getTotalDurationInMillis
public long getTotalDurationInMillis()Description copied from interface:MeasurementDataReturns the total duration of all calls in this measurement.- Specified by:
getTotalDurationInMillisin interfaceMeasurementData- Returns:
- the total duration of all calls
-
getNumberOfSlowCalls
public int getNumberOfSlowCalls()Description copied from interface:MeasurementDataReturns the number of calls in this measurement which were slower than a certain threshold.- Specified by:
getNumberOfSlowCallsin interfaceMeasurementData- Returns:
- the number of calls which were slower than a certain threshold
-
getNumberOfSlowFailedCalls
public int getNumberOfSlowFailedCalls()Description copied from interface:MeasurementDataReturns the number of failed calls in this measurement which were slower than a certain threshold.- Specified by:
getNumberOfSlowFailedCallsin interfaceMeasurementData- Returns:
- the number of failed calls which were slower than a certain threshold
-
getNumberOfFailedCalls
public int getNumberOfFailedCalls()Description copied from interface:MeasurementDataReturns the number of failed calls in this measurement.- Specified by:
getNumberOfFailedCallsin interfaceMeasurementData- Returns:
- the number of failed calls
-
getNumberOfCalls
public int getNumberOfCalls()Description copied from interface:MeasurementDataReturns the total number of all calls in this measurement.- Specified by:
getNumberOfCallsin interfaceMeasurementData- Returns:
- the total number of all calls
-
toString
-