Record Class SLOState

java.lang.Object
java.lang.Record
com.tnsai.quality.slo.SLOState
Record Components:
definition - the SLO this state describes
currentCompliance - observed compliance percentage in [0,100]
errorBudgetRemaining - fraction of the budget left, in [0,1] — 1.0 means full budget, 0.0 means exhausted
burn - burn-rate sample for this SLO
status - coarse status bucket
evaluatedAt - when the snapshot was taken

public record SLOState(SLODefinition definition, double currentCompliance, double errorBudgetRemaining, BurnRateMetric burn, SLOStatus status, Instant evaluatedAt) extends Record
Point-in-time snapshot of an SLO's health, produced by SLOEvaluator.evaluate(SLODefinition, Instant) (issue #92).
Since:
0.5.0 (issue #92)
  • Constructor Details

    • SLOState

      public SLOState(SLODefinition definition, double currentCompliance, double errorBudgetRemaining, BurnRateMetric burn, SLOStatus status, Instant evaluatedAt)
      Creates an instance of a SLOState record class.
      Parameters:
      definition - the value for the definition record component
      currentCompliance - the value for the currentCompliance record component
      errorBudgetRemaining - the value for the errorBudgetRemaining record component
      burn - the value for the burn record component
      status - the value for the status record component
      evaluatedAt - the value for the evaluatedAt record component
  • Method Details

    • 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.
    • definition

      public SLODefinition definition()
      Returns the value of the definition record component.
      Returns:
      the value of the definition record component
    • currentCompliance

      public double currentCompliance()
      Returns the value of the currentCompliance record component.
      Returns:
      the value of the currentCompliance record component
    • errorBudgetRemaining

      public double errorBudgetRemaining()
      Returns the value of the errorBudgetRemaining record component.
      Returns:
      the value of the errorBudgetRemaining record component
    • burn

      public BurnRateMetric burn()
      Returns the value of the burn record component.
      Returns:
      the value of the burn record component
    • status

      public SLOStatus status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • evaluatedAt

      public Instant evaluatedAt()
      Returns the value of the evaluatedAt record component.
      Returns:
      the value of the evaluatedAt record component