Record Class BurnRateMetric

java.lang.Object
java.lang.Record
com.tnsai.quality.slo.BurnRateMetric
Record Components:
shortWindowRate - observed burn rate over the configured short window
longWindowRate - observed burn rate over the configured long window

public record BurnRateMetric(double shortWindowRate, double longWindowRate) extends Record
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

    Constructors
    Constructor
    Description
    BurnRateMetric(double shortWindowRate, double longWindowRate)
    Creates an instance of a BurnRateMetric record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    boolean
    Both windows below the configured thresholds — no burn alarm.
    final int
    Returns a hash code value for this object.
    Convenience: zero-rate sample (start of window, no events yet).
    double
    Returns the value of the longWindowRate record component.
    double
    Returns the value of the shortWindowRate record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • BurnRateMetric

      public BurnRateMetric(double shortWindowRate, double longWindowRate)
      Creates an instance of a BurnRateMetric record class.
      Parameters:
      shortWindowRate - the value for the shortWindowRate record component
      longWindowRate - the value for the longWindowRate record component
  • Method Details

    • exceeds

      public boolean exceeds(BurnRateConfig cfg)
      Both windows below the configured thresholds — no burn alarm.
    • idle

      public static BurnRateMetric idle()
      Convenience: zero-rate sample (start of window, no events yet).
    • 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. All components in this record class 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.
    • shortWindowRate

      public double shortWindowRate()
      Returns the value of the shortWindowRate record component.
      Returns:
      the value of the shortWindowRate record component
    • longWindowRate

      public double longWindowRate()
      Returns the value of the longWindowRate record component.
      Returns:
      the value of the longWindowRate record component