Class SamplingRule
- java.lang.Object
-
- com.amazonaws.xray.strategy.sampling.rule.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 newSamplingRule
.
-
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()
-
-
-
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 newSamplingRule
. Patterns are supported in thehost
,httpMethod
, andurlPath
parameters. Patterns are matched using theSearchPattern
class.- Parameters:
host
- the host name for which the rule should applyserviceName
- the service name for which the rule should applyhttpMethod
- the http method for which the rule should applyurlPath
- the urlPath for which the rule should applyfixedTarget
- the number of traces per any given second for which the sampling rule will samplerate
- 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 classjava.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 returntrue
, for any rule.- Parameters:
requestHost
- the host name for the incoming request.requestPath
- the path from the incoming requestrequestMethod
- the method used to make the incoming request- Returns:
- whether or not this rule applies to the incoming request
-
-