Class CentralizedRule

All Implemented Interfaces:
Rule, java.lang.Comparable<CentralizedRule>

public class CentralizedRule
extends java.lang.Object
implements Rule, java.lang.Comparable<CentralizedRule>
Represents a customer-defined sampling rule. A rule contains the matchers required to determine if an incoming request can use the rule, and sampling targets which determine the sampling behavior once a request has been matched. A rule also maintains usage statistics which are periodically reported to X-Ray.
  • Field Summary

    Modifier and Type Field Description
    static java.lang.String DEFAULT_RULE_NAME  
  • Constructor Summary

    Constructor Description
    CentralizedRule​( input, Rand rand)  
  • Method Summary

    Modifier and Type Method Description
    int compareTo​(CentralizedRule other)  
    boolean equals​(@Nullable java.lang.Object o)  
    java.lang.String getName()  
    int hashCode()  
    boolean isStale​(java.time.Instant now)  
    static boolean isValid​( rule)  
    boolean match​(SamplingRequest r)  
    SamplingResponse sample​(java.time.Instant now) snapshot​(java.util.Date now)  
    boolean update​( i)  
    void update​( t, java.time.Instant now)  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details


      public static final java.lang.String DEFAULT_RULE_NAME
      See Also:
      Constant Field Values
  • Constructor Details

    • CentralizedRule

      public CentralizedRule​( input, Rand rand)
  • Method Details

    • update

      public boolean update​( i)
    • isStale

      public boolean isStale​(java.time.Instant now)
    • isValid

      public static boolean isValid​( rule)
    • update

      public void update​( t, java.time.Instant now)
    • snapshot

      public snapshot​(java.util.Date now)
    • match

      public boolean match​(SamplingRequest r)
    • sample

      public SamplingResponse sample​(java.time.Instant now)
      Specified by:
      sample in interface Rule
    • compareTo

      public int compareTo​(CentralizedRule other)
      Specified by:
      compareTo in interface java.lang.Comparable<CentralizedRule>
    • getName

      public java.lang.String getName()
    • equals

      public boolean equals​(@Nullable java.lang.Object o)
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      hashCode in class java.lang.Object