Record Class ResilienceMetrics.MetricSnapshot

java.lang.Object
java.lang.Record
com.tnsai.resilience.ResilienceMetrics.MetricSnapshot
Enclosing class:
ResilienceMetrics

public static record ResilienceMetrics.MetricSnapshot(String name, long total, long success, long failure, Map<Long,Long> latencyBuckets) extends Record
Immutable snapshot of one metric's state at the moment ResilienceMetrics.snapshot(java.lang.String) was called.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MetricSnapshot(String name, long total, long success, long failure, Map<Long,Long> latencyBuckets)
    Creates an instance of a MetricSnapshot record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    long
    Returns the value of the failure record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the latencyBuckets record component.
    Returns the value of the name record component.
    long
    Returns the value of the success record component.
    double
    Convenience: success rate as a value in [0, 1]; 0 when no calls recorded.
    final String
    Returns a string representation of this record class.
    long
    Returns the value of the total record component.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MetricSnapshot

      public MetricSnapshot(String name, long total, long success, long failure, Map<Long,Long> latencyBuckets)
      Creates an instance of a MetricSnapshot record class.
      Parameters:
      name - the value for the name record component
      total - the value for the total record component
      success - the value for the success record component
      failure - the value for the failure record component
      latencyBuckets - the value for the latencyBuckets record component
  • Method Details

    • successRate

      public double successRate()
      Convenience: success rate as a value in [0, 1]; 0 when no calls recorded.
    • 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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • total

      public long total()
      Returns the value of the total record component.
      Returns:
      the value of the total record component
    • success

      public long success()
      Returns the value of the success record component.
      Returns:
      the value of the success record component
    • failure

      public long failure()
      Returns the value of the failure record component.
      Returns:
      the value of the failure record component
    • latencyBuckets

      public Map<Long,Long> latencyBuckets()
      Returns the value of the latencyBuckets record component.
      Returns:
      the value of the latencyBuckets record component