Record Class BurnRateConfig

java.lang.Object
java.lang.Record
com.tnsai.quality.slo.BurnRateConfig

public record BurnRateConfig(double shortWindowBurnRate, Duration shortWindow, double longWindowBurnRate, Duration longWindow) extends Record
Multi-window burn-rate alerting thresholds (issue #92), per the SRE workbook recipe — a single burn-rate signal is too noisy on its own, so the framework requires a fast-window AND a slow-window signal to fire before treating an SLO as actively burning.

Typical values from the SRE workbook for a 30-day SLO window:

  • shortWindow = 1h, shortWindowBurnRate = 14.4 — alerts when 2% of the monthly budget would be consumed in 1h
  • longWindow = 6h, longWindowBurnRate = 6.0 — alerts when 10% of the monthly budget would be consumed in 6h
Since:
0.5.0 (issue #92)
  • Constructor Summary

    Constructors
    Constructor
    Description
    BurnRateConfig(double shortWindowBurnRate, Duration shortWindow, double longWindowBurnRate, Duration longWindow)
    Creates an instance of a BurnRateConfig record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the longWindow record component.
    double
    Returns the value of the longWindowBurnRate record component.
    Returns the value of the shortWindow record component.
    double
    Returns the value of the shortWindowBurnRate record component.
    Standard SRE-workbook defaults for a 30-day window: 14.4× over 1h + 6× over 6h.
    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

    • BurnRateConfig

      public BurnRateConfig(double shortWindowBurnRate, Duration shortWindow, double longWindowBurnRate, Duration longWindow)
      Creates an instance of a BurnRateConfig record class.
      Parameters:
      shortWindowBurnRate - the value for the shortWindowBurnRate record component
      shortWindow - the value for the shortWindow record component
      longWindowBurnRate - the value for the longWindowBurnRate record component
      longWindow - the value for the longWindow record component
  • Method Details

    • standardDefaults

      public static BurnRateConfig standardDefaults()
      Standard SRE-workbook defaults for a 30-day window: 14.4× over 1h + 6× over 6h. Use as a starting point and tune per-SLO from there.
    • 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.
    • shortWindowBurnRate

      public double shortWindowBurnRate()
      Returns the value of the shortWindowBurnRate record component.
      Returns:
      the value of the shortWindowBurnRate record component
    • shortWindow

      public Duration shortWindow()
      Returns the value of the shortWindow record component.
      Returns:
      the value of the shortWindow record component
    • longWindowBurnRate

      public double longWindowBurnRate()
      Returns the value of the longWindowBurnRate record component.
      Returns:
      the value of the longWindowBurnRate record component
    • longWindow

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