com.ccadllc.cedi.circuitbreaker.statistics
An Algebraic Data Type (ADT) which represents the latest state change for a FailureStatistics
instance.
An Algebraic Data Type (ADT) which represents the latest state change for a FailureStatistics
instance.
If the changed
property of the FailureStatististics
instance is set to Some(Opened
), it indicates the
associated CircuitBreaker
has just transitioned to open, if set to Some(Closed
), it indicates it has just
transitioned to closed, and if set to None, it indicates that the CircuitBreaker
was already opened or
closed prior to the latest statistics update.
The sliding statistics, which maintains a pass/failure boolean indicator for results of the execution of programs protected by the associated CircuitBreaker.
The sliding statistics, which maintains a pass/failure boolean indicator for results of the
execution of programs protected by the associated CircuitBreaker. Each pass/failure indicator
is associated with a java.time.Instant
timestamp in the SlidingVector contained here and the
sliding vector keeps only the items with associated time-stamps in the configured range of the statistics
window (specified when the SlidingVector[Boolean]
is created).
- the SlidingVector[Boolean]
containing the pass/fail indicators for the latest
protected program executions which fall within the configured time range of the statistics window (e.g.,
a 30s configuration would keep all items with a timestamp that falls within 30 seconds of the current time).
This data type is used for testing the protected program by periodically letting the program execute when the associated CircuitBreaker is open, so that we can determine when it is appropriate to close the CB after a configured minimum number of consecutive execution successes.
This data type is used for testing the protected program by periodically letting the program execute when the associated CircuitBreaker is open, so that we can determine when it is appropriate to close the CB after a configured minimum number of consecutive execution successes.
- the FailureSettings#Test configuration for testing an open CircuitBreaker
, including the minimum number of
consecutive tests to close an open CB and the minimum time interval between tests (between which program executions are failed
fast without executing).
- the java.time.Instant
timestamp indicating the time the last test was executed.FailureSettings#Test
configuration for testing an open CircuitBreaker
.
- the current number of consecutive test execution successes.
The companion object for instances of SlidingAggregateMetrics
instances provides a smart constructor for an initial
instance (all other instances are created via instance methods).
Creates an initial instance of the FailureStatistics
with the passed-in identifier and configuration.
Creates an initial instance of the FailureStatistics
with the passed-in identifier and configuration. All other
instances are created by instance methods when the state needs updating.
- the CircuitBreaker#Identifier of the associated CircuitBreaker instance, binding the two together.
- the FailureSettings of the associated CircuitBreaker
, used to configure the statistics
as appropriate.
initialFailureSettings - the initial instance for this data type.
The companion object to the
FailureStatistics
instances, providing various data types and constructor functions used by and for those instances.