Class SamplingRule

java.lang.Object
com.amazonaws.xray.strategy.sampling.rule.SamplingRule

public class SamplingRule extends Object
  • Constructor Details

    • SamplingRule

      public SamplingRule()
    • SamplingRule

      public SamplingRule(String host, String serviceName, String httpMethod, String urlPath, int fixedTarget, float rate)
      Constructs a new SamplingRule. Patterns are supported in the host, httpMethod, and urlPath parameters. Patterns are matched using the SearchPattern class.
      Parameters:
      host - the host name for which the rule should apply
      serviceName - the service name for which the rule should apply
      httpMethod - the http method for which the rule should apply
      urlPath - the urlPath for which the rule should apply
      fixedTarget - the number of traces per any given second for which the sampling rule will sample
      rate - the rate at which the rule should sample, after the fixedTarget has been reached
  • Method Details

    • getServiceName

      public @Nullable String getServiceName()
      Returns:
      the serviceName
    • setServiceName

      public void setServiceName(String serviceName)
      Parameters:
      serviceName - the serviceName to set
    • getHost

      public @Nullable String getHost()
      Returns:
      the host
    • setHost

      public void setHost(@Nullable String host)
      Parameters:
      host - the host to set
    • getHttpMethod

      public @Nullable String getHttpMethod()
      Returns:
      the httpMethod
    • setHttpMethod

      public void setHttpMethod(String httpMethod)
      Parameters:
      httpMethod - the httpMethod to set
    • getUrlPath

      public @Nullable String getUrlPath()
      Returns:
      the urlPath
    • setUrlPath

      public void setUrlPath(String urlPath)
      Parameters:
      urlPath - the urlPath to set
    • getFixedTarget

      public int getFixedTarget()
      Returns:
      the fixedTarget
    • setFixedTarget

      public void setFixedTarget(int fixedTarget)
      Parameters:
      fixedTarget - the fixedTarget to set
    • getRate

      public float getRate()
      Returns:
      the rate
    • setRate

      public void setRate(float rate)
      Parameters:
      rate - the rate to set
    • getReservoir

      public Reservoir getReservoir()
      Returns:
      the reservoir
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • appliesTo

      public boolean appliesTo(String requestHost, String requestPath, String requestMethod)
      Determines whether or not this sampling rule applies to the incoming request based on some of the request's parameters. Any null parameters provided will be considered an implicit match. For example, appliesTo(null, null, null) will always return true, for any rule.
      Parameters:
      requestHost - the host name for the incoming request.
      requestPath - the path from the incoming request
      requestMethod - the method used to make the incoming request
      Returns:
      whether or not this rule applies to the incoming request