Package com.tnsai.resilience
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
ConstructorsConstructorDescriptionMetricSnapshot(String name, long total, long success, long failure, Map<Long, Long> latencyBuckets) Creates an instance of aMetricSnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.longfailure()Returns the value of thefailurerecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thelatencyBucketsrecord component.name()Returns the value of thenamerecord component.longsuccess()Returns the value of thesuccessrecord component.doubleConvenience: success rate as a value in [0, 1]; 0 when no calls recorded.final StringtoString()Returns a string representation of this record class.longtotal()Returns the value of thetotalrecord component.
-
Constructor Details
-
MetricSnapshot
public MetricSnapshot(String name, long total, long success, long failure, Map<Long, Long> latencyBuckets) Creates an instance of aMetricSnapshotrecord class.- Parameters:
name- the value for thenamerecord componenttotal- the value for thetotalrecord componentsuccess- the value for thesuccessrecord componentfailure- the value for thefailurerecord componentlatencyBuckets- the value for thelatencyBucketsrecord component
-
-
Method Details
-
successRate
public double successRate()Convenience: success rate as a value in [0, 1]; 0 when no calls recorded. -
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 '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
total
public long total()Returns the value of thetotalrecord component.- Returns:
- the value of the
totalrecord component
-
success
public long success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
failure
public long failure()Returns the value of thefailurerecord component.- Returns:
- the value of the
failurerecord component
-
latencyBuckets
Returns the value of thelatencyBucketsrecord component.- Returns:
- the value of the
latencyBucketsrecord component
-