Top Description Fields Constructors Methods
io.github.resilience4j.core.metrics

public Class PackedAggregation

extends Object
implements CumulativeMeasurement
Class Inheritance
All Implemented Interfaces
io.github.resilience4j.core.metrics.CumulativeMeasurement, io.github.resilience4j.core.metrics.MeasurementData
Imports
java.util.Arrays, java.util.concurrent.TimeUnit

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.

Field Summary

Modifier and TypeField and Description
private static final int
private int[]
private static final int
private long[]
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
public
PackedAggregation(long[] durations, int[] counts)

Method Summary

Modifier and TypeMethod and Description
pack-priv PackedAggregation
copy()

pack-priv void
public int
getNumberOfCalls()

Implements io.github.resilience4j.core.metrics.MeasurementData.getNumberOfCalls.

Returns the total number of all calls in this measurement.

public int
getNumberOfFailedCalls()

Implements io.github.resilience4j.core.metrics.MeasurementData.getNumberOfFailedCalls.

Returns the number of failed calls in this measurement.

public int
getNumberOfSlowCalls()

Implements io.github.resilience4j.core.metrics.MeasurementData.getNumberOfSlowCalls.

Returns the number of calls in this measurement which were slower than a certain threshold.

public int
getNumberOfSlowFailedCalls()

Implements io.github.resilience4j.core.metrics.MeasurementData.getNumberOfSlowFailedCalls.

Returns the number of failed calls in this measurement which were slower than a certain threshold.

public long
getTotalDurationInMillis()

Implements io.github.resilience4j.core.metrics.MeasurementData.getTotalDurationInMillis.

Returns the total duration of all calls in this measurement.

public void
record(long
the call duration
duration
,
TimeUnit
the time unit of the call duration
durationUnit
,
Metrics.Outcome
the outcome of the call
outcome
)

Implements io.github.resilience4j.core.metrics.CumulativeMeasurement.record.

Records a call duration and its outcome.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

CALLS_INDEXback to summary
private static final int CALLS_INDEX
countsback to summary
private int[] counts
DURATION_INDEXback to summary
private static final int DURATION_INDEX
durationsback to summary
private long[] durations
FAILED_CALLS_INDEXback to summary
private static final int FAILED_CALLS_INDEX
FAILED_SLOW_CALLS_INDEXback to summary
private static final int FAILED_SLOW_CALLS_INDEX
SLOW_CALLS_INDEXback to summary
private static final int SLOW_CALLS_INDEX
TOTAL_CALLS_INDEXback to summary
private static final int TOTAL_CALLS_INDEX
TOTAL_DURATION_INDEXback to summary
private static final int TOTAL_DURATION_INDEX
TOTAL_FAILED_CALLS_INDEXback to summary
private static final int TOTAL_FAILED_CALLS_INDEX
TOTAL_FAILED_SLOW_CALLS_INDEXback to summary
private static final int TOTAL_FAILED_SLOW_CALLS_INDEX
TOTAL_SLOW_CALLS_INDEXback to summary
private static final int TOTAL_SLOW_CALLS_INDEX

Constructor Detail

PackedAggregationback to summary
public PackedAggregation()
PackedAggregationback to summary
public PackedAggregation(long[] durations, int[] counts)

Method Detail

copyback to summary
pack-priv PackedAggregation copy()
discardback to summary
pack-priv void discard(PackedAggregation discarded)
getNumberOfCallsback to summary
public int getNumberOfCalls()

Implements io.github.resilience4j.core.metrics.MeasurementData.getNumberOfCalls.

Doc from io.github.resilience4j.core.metrics.MeasurementData.getNumberOfCalls.

Returns the total number of all calls in this measurement.

Returns:int

the total number of all calls

Annotations
@Override
getNumberOfFailedCallsback to summary
public int getNumberOfFailedCalls()

Implements io.github.resilience4j.core.metrics.MeasurementData.getNumberOfFailedCalls.

Doc from io.github.resilience4j.core.metrics.MeasurementData.getNumberOfFailedCalls.

Returns the number of failed calls in this measurement.

Returns:int

the number of failed calls

Annotations
@Override
getNumberOfSlowCallsback to summary
public int getNumberOfSlowCalls()

Implements io.github.resilience4j.core.metrics.MeasurementData.getNumberOfSlowCalls.

Doc from io.github.resilience4j.core.metrics.MeasurementData.getNumberOfSlowCalls.

Returns the number of calls in this measurement which were slower than a certain threshold.

Returns:int

the number of calls which were slower than a certain threshold

Annotations
@Override
getNumberOfSlowFailedCallsback to summary
public int getNumberOfSlowFailedCalls()

Implements io.github.resilience4j.core.metrics.MeasurementData.getNumberOfSlowFailedCalls.

Doc from io.github.resilience4j.core.metrics.MeasurementData.getNumberOfSlowFailedCalls.

Returns the number of failed calls in this measurement which were slower than a certain threshold.

Returns:int

the number of failed calls which were slower than a certain threshold

Annotations
@Override
getTotalDurationInMillisback to summary
public long getTotalDurationInMillis()

Implements io.github.resilience4j.core.metrics.MeasurementData.getTotalDurationInMillis.

Doc from io.github.resilience4j.core.metrics.MeasurementData.getTotalDurationInMillis.

Returns the total duration of all calls in this measurement.

Returns:long

the total duration of all calls

Annotations
@Override
recordback to summary
public void record(long duration, TimeUnit durationUnit, Metrics.Outcome outcome)

Implements io.github.resilience4j.core.metrics.CumulativeMeasurement.record.

Doc from io.github.resilience4j.core.metrics.CumulativeMeasurement.record.

Records a call duration and its outcome.

Parameters
duration:long

the call duration

durationUnit:TimeUnit

the time unit of the call duration

outcome:Metrics.Outcome

the outcome of the call

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override