Package com.tnsai.llm.resilience
Record Class CircuitBreakerClient.CircuitBreakerMetrics
java.lang.Object
java.lang.Record
com.tnsai.llm.resilience.CircuitBreakerClient.CircuitBreakerMetrics
- Enclosing class:
CircuitBreakerClient
public static record CircuitBreakerClient.CircuitBreakerMetrics(CircuitBreakerClient.State state, long totalRequests, long successCount, long failureCount, long rejectedCount, long stateTransitions, int consecutiveFailures, int failureThreshold, Duration recoveryTimeout)
extends Record
Snapshot of circuit breaker metrics.
-
Constructor Summary
ConstructorsConstructorDescriptionCircuitBreakerMetrics(CircuitBreakerClient.State state, long totalRequests, long successCount, long failureCount, long rejectedCount, long stateTransitions, int consecutiveFailures, int failureThreshold, Duration recoveryTimeout) Creates an instance of aCircuitBreakerMetricsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theconsecutiveFailuresrecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of thefailureCountrecord component.intReturns the value of thefailureThresholdrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of therecoveryTimeoutrecord component.longReturns the value of therejectedCountrecord component.state()Returns the value of thestaterecord component.longReturns the value of thestateTransitionsrecord component.longReturns the value of thesuccessCountrecord component.doubleReturns the success rate as a percentage (0.0 to 100.0).final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalRequestsrecord component.
-
Constructor Details
-
CircuitBreakerMetrics
public CircuitBreakerMetrics(CircuitBreakerClient.State state, long totalRequests, long successCount, long failureCount, long rejectedCount, long stateTransitions, int consecutiveFailures, int failureThreshold, Duration recoveryTimeout) Creates an instance of aCircuitBreakerMetricsrecord class.- Parameters:
state- the value for thestaterecord componenttotalRequests- the value for thetotalRequestsrecord componentsuccessCount- the value for thesuccessCountrecord componentfailureCount- the value for thefailureCountrecord componentrejectedCount- the value for therejectedCountrecord componentstateTransitions- the value for thestateTransitionsrecord componentconsecutiveFailures- the value for theconsecutiveFailuresrecord componentfailureThreshold- the value for thefailureThresholdrecord componentrecoveryTimeout- the value for therecoveryTimeoutrecord component
-
-
Method Details
-
successRate
public double successRate()Returns the success rate as a percentage (0.0 to 100.0). -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
state
Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-
totalRequests
public long totalRequests()Returns the value of thetotalRequestsrecord component.- Returns:
- the value of the
totalRequestsrecord component
-
successCount
public long successCount()Returns the value of thesuccessCountrecord component.- Returns:
- the value of the
successCountrecord component
-
failureCount
public long failureCount()Returns the value of thefailureCountrecord component.- Returns:
- the value of the
failureCountrecord component
-
rejectedCount
public long rejectedCount()Returns the value of therejectedCountrecord component.- Returns:
- the value of the
rejectedCountrecord component
-
stateTransitions
public long stateTransitions()Returns the value of thestateTransitionsrecord component.- Returns:
- the value of the
stateTransitionsrecord component
-
consecutiveFailures
public int consecutiveFailures()Returns the value of theconsecutiveFailuresrecord component.- Returns:
- the value of the
consecutiveFailuresrecord component
-
failureThreshold
public int failureThreshold()Returns the value of thefailureThresholdrecord component.- Returns:
- the value of the
failureThresholdrecord component
-
recoveryTimeout
Returns the value of therecoveryTimeoutrecord component.- Returns:
- the value of the
recoveryTimeoutrecord component
-