Package com.tnsai.quality.slo
Record Class BurnRateMetric
java.lang.Object
java.lang.Record
com.tnsai.quality.slo.BurnRateMetric
- Record Components:
shortWindowRate- observed burn rate over the configured short windowlongWindowRate- observed burn rate over the configured long window
Burn-rate sample for one
SLOState (issue #92): how fast is
the error budget being consumed in the short and long windows?
A burn rate of 1.0 means budget is being consumed exactly
at the rate the SLO window allows — a 30-day SLO with target 99.9%
accepts 0.1% errors over 30 days; burning at 1.0× means we're spending
that 0.1% evenly. > 1.0 means faster than budget; 14.4×
over 1h means 2% of the monthly budget would be spent in that hour.
Either rate can be 0 (no errors observed) or
Double.POSITIVE_INFINITY (all attempts failing); evaluator
implementations clamp infinity for display where needed.
- Since:
- 0.5.0 (issue #92)
-
Constructor Summary
ConstructorsConstructorDescriptionBurnRateMetric(double shortWindowRate, double longWindowRate) Creates an instance of aBurnRateMetricrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.booleanexceeds(BurnRateConfig cfg) Both windows below the configured thresholds — no burn alarm.final inthashCode()Returns a hash code value for this object.static BurnRateMetricidle()Convenience: zero-rate sample (start of window, no events yet).doubleReturns the value of thelongWindowRaterecord component.doubleReturns the value of theshortWindowRaterecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
BurnRateMetric
public BurnRateMetric(double shortWindowRate, double longWindowRate) Creates an instance of aBurnRateMetricrecord class.- Parameters:
shortWindowRate- the value for theshortWindowRaterecord componentlongWindowRate- the value for thelongWindowRaterecord component
-
-
Method Details
-
exceeds
Both windows below the configured thresholds — no burn alarm. -
idle
Convenience: zero-rate sample (start of window, no events yet). -
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. All components in this record class are compared with '=='. -
shortWindowRate
public double shortWindowRate()Returns the value of theshortWindowRaterecord component.- Returns:
- the value of the
shortWindowRaterecord component
-
longWindowRate
public double longWindowRate()Returns the value of thelongWindowRaterecord component.- Returns:
- the value of the
longWindowRaterecord component
-