Record Class CanaryPolicy

java.lang.Object
java.lang.Record
org.j7m.middleware.cluster.CanaryPolicy
Record Components:
revision - monotonically increasing policy revision
baseline - compatible fallback release identity
canary - candidate release identity
canaryWeight - candidate exposure, 0..10000 basis points
minimumSamples - required candidate observations, 1..1000000
maximumErrorRate - tolerated candidate error fraction, 0..1
maximumMeanLatencyMillis - tolerated arithmetic mean candidate latency, positive milliseconds
maximumProbeAgeMillis - maximum observation age, 1..60000 milliseconds

public record CanaryPolicy(long revision, String baseline, String canary, int canaryWeight, long minimumSamples, double maximumErrorRate, long maximumMeanLatencyMillis, long maximumProbeAgeMillis) extends Record
Immutable traffic and observation policy. Weights are basis points, not a customer SLO. Routing is stable for one policy revision; changing revisions may deliberately reroute retries. Applications must preserve their own idempotent request identities across deployment changes.
  • Constructor Details

    • CanaryPolicy

      public CanaryPolicy(long revision, String baseline, String canary, int canaryWeight, long minimumSamples, double maximumErrorRate, long maximumMeanLatencyMillis, long maximumProbeAgeMillis)
      Validates identities and finite thresholds before any mutation.
      Parameters:
      revision - positive revision
      baseline - fallback release
      canary - distinct candidate release
      canaryWeight - basis points
      minimumSamples - candidate sample threshold
      maximumErrorRate - finite error fraction
      maximumMeanLatencyMillis - positive latency threshold
      maximumProbeAgeMillis - bounded freshness threshold
      Throws:
      IllegalArgumentException - if an identity or bound is invalid
  • 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 the compare method from their corresponding wrapper classes.
      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.
    • revision

      public long revision()
      Returns the value of the revision record component.
      Returns:
      the value of the revision record component
    • baseline

      public String baseline()
      Returns the value of the baseline record component.
      Returns:
      the value of the baseline record component
    • canary

      public String canary()
      Returns the value of the canary record component.
      Returns:
      the value of the canary record component
    • canaryWeight

      public int canaryWeight()
      Returns the value of the canaryWeight record component.
      Returns:
      the value of the canaryWeight record component
    • minimumSamples

      public long minimumSamples()
      Returns the value of the minimumSamples record component.
      Returns:
      the value of the minimumSamples record component
    • maximumErrorRate

      public double maximumErrorRate()
      Returns the value of the maximumErrorRate record component.
      Returns:
      the value of the maximumErrorRate record component
    • maximumMeanLatencyMillis

      public long maximumMeanLatencyMillis()
      Returns the value of the maximumMeanLatencyMillis record component.
      Returns:
      the value of the maximumMeanLatencyMillis record component
    • maximumProbeAgeMillis

      public long maximumProbeAgeMillis()
      Returns the value of the maximumProbeAgeMillis record component.
      Returns:
      the value of the maximumProbeAgeMillis record component