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

    Constructors
    Constructor
    Description
    CircuitBreakerMetrics(CircuitBreakerClient.State state, long totalRequests, long successCount, long failureCount, long rejectedCount, long stateTransitions, int consecutiveFailures, int failureThreshold, Duration recoveryTimeout)
    Creates an instance of a CircuitBreakerMetrics record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the consecutiveFailures record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    long
    Returns the value of the failureCount record component.
    int
    Returns the value of the failureThreshold record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the recoveryTimeout record component.
    long
    Returns the value of the rejectedCount record component.
    Returns the value of the state record component.
    long
    Returns the value of the stateTransitions record component.
    long
    Returns the value of the successCount record component.
    double
    Returns the success rate as a percentage (0.0 to 100.0).
    final String
    Returns a string representation of this record class.
    long
    Returns the value of the totalRequests record component.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • 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 a CircuitBreakerMetrics record class.
      Parameters:
      state - the value for the state record component
      totalRequests - the value for the totalRequests record component
      successCount - the value for the successCount record component
      failureCount - the value for the failureCount record component
      rejectedCount - the value for the rejectedCount record component
      stateTransitions - the value for the stateTransitions record component
      consecutiveFailures - the value for the consecutiveFailures record component
      failureThreshold - the value for the failureThreshold record component
      recoveryTimeout - the value for the recoveryTimeout record component
  • Method Details

    • successRate

      public double successRate()
      Returns the success rate as a percentage (0.0 to 100.0).
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • state

      Returns the value of the state record component.
      Returns:
      the value of the state record component
    • totalRequests

      public long totalRequests()
      Returns the value of the totalRequests record component.
      Returns:
      the value of the totalRequests record component
    • successCount

      public long successCount()
      Returns the value of the successCount record component.
      Returns:
      the value of the successCount record component
    • failureCount

      public long failureCount()
      Returns the value of the failureCount record component.
      Returns:
      the value of the failureCount record component
    • rejectedCount

      public long rejectedCount()
      Returns the value of the rejectedCount record component.
      Returns:
      the value of the rejectedCount record component
    • stateTransitions

      public long stateTransitions()
      Returns the value of the stateTransitions record component.
      Returns:
      the value of the stateTransitions record component
    • consecutiveFailures

      public int consecutiveFailures()
      Returns the value of the consecutiveFailures record component.
      Returns:
      the value of the consecutiveFailures record component
    • failureThreshold

      public int failureThreshold()
      Returns the value of the failureThreshold record component.
      Returns:
      the value of the failureThreshold record component
    • recoveryTimeout

      public Duration recoveryTimeout()
      Returns the value of the recoveryTimeout record component.
      Returns:
      the value of the recoveryTimeout record component