public final class GuaranteedThroughputSampler extends java.lang.Object implements Sampler
GuaranteedThroughputSampler
is a Sampler
that guarantees a throughput by using
a ProbabilisticSampler
and RateLimitingSampler
in tandem.
The RateLimitingSampler is used to establish a lowerBound so that every operation is sampled
at least once in the time interval defined by the lowerBound.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TYPE |
Constructor and Description |
---|
GuaranteedThroughputSampler(double samplingRate,
double lowerBound) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Release any resources used by the sampler.
|
SamplingStatus |
sample(java.lang.String operation,
long id)
Calls
Sampler.sample(String, long) (String, long)} on both samplers, returning true for
SamplingStatus.isSampled if either samplers set #isSampled to true. |
boolean |
update(double samplingRate,
double lowerBound)
Updates the probabilistic and lowerBound samplers
|
public static final java.lang.String TYPE
public GuaranteedThroughputSampler(double samplingRate, double lowerBound)
public boolean update(double samplingRate, double lowerBound)
samplingRate
- The sampling rate for probabilistic samplinglowerBound
- The lower bound limit for lower bound samplingpublic SamplingStatus sample(java.lang.String operation, long id)
Sampler.sample(String, long)
(String, long)} on both samplers, returning true for
SamplingStatus.isSampled
if either samplers set #isSampled to true.
The tags corresponding to the sampler that returned true are set on SamplingStatus.tags
If both samplers return true, tags for ProbabilisticSampler
is given priority.