Class SamplingRule


  • public class SamplingRule
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      SamplingRule()  
      SamplingRule​(java.lang.String host, java.lang.String serviceName, java.lang.String httpMethod, java.lang.String urlPath, int fixedTarget, float rate)
      Constructs a new SamplingRule.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean appliesTo​(java.lang.String requestHost, java.lang.String requestPath, java.lang.String requestMethod)
      Determines whether or not this sampling rule applies to the incoming request based on some of the request's parameters.
      int getFixedTarget()  
      @Nullable java.lang.String getHost()  
      @Nullable java.lang.String getHttpMethod()  
      float getRate()  
      Reservoir getReservoir()  
      @Nullable java.lang.String getServiceName()  
      @Nullable java.lang.String getUrlPath()  
      void setFixedTarget​(int fixedTarget)  
      void setHost​(@Nullable java.lang.String host)  
      void setHttpMethod​(java.lang.String httpMethod)  
      void setRate​(float rate)  
      void setServiceName​(java.lang.String serviceName)  
      void setUrlPath​(java.lang.String urlPath)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SamplingRule

        public SamplingRule()
      • SamplingRule

        public SamplingRule​(java.lang.String host,
                            java.lang.String serviceName,
                            java.lang.String httpMethod,
                            java.lang.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 Detail

      • getServiceName

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

        public void setServiceName​(java.lang.String serviceName)
        Parameters:
        serviceName - the serviceName to set
      • getHost

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

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

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

        public void setHttpMethod​(java.lang.String httpMethod)
        Parameters:
        httpMethod - the httpMethod to set
      • getUrlPath

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

        public void setUrlPath​(java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • appliesTo

        public boolean appliesTo​(java.lang.String requestHost,
                                 java.lang.String requestPath,
                                 java.lang.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