Class AdaptiveSampleFilter
- java.lang.Object
-
- fish.payara.nucleus.requesttracing.sampling.SampleFilter
-
- fish.payara.nucleus.requesttracing.sampling.AdaptiveSampleFilter
-
public class AdaptiveSampleFilter extends SampleFilter
SampleFilter
that changes the sample rate dynamically to meet a given target.
-
-
Field Summary
Fields Modifier and Type Field Description protected Clock
clock
The clock to use to get the current time.-
Fields inherited from class fish.payara.nucleus.requesttracing.sampling.SampleFilter
sampleRate
-
-
Constructor Summary
Constructors Constructor Description AdaptiveSampleFilter(double sampleRate, Integer targetCount, Integer targetTimeValue, TimeUnit targetTimeUnit)
Initialises the sample filter with a specified initial sample rate and target.
-
-
-
Field Detail
-
clock
protected Clock clock
The clock to use to get the current time. Absolute time is irrelevant, but this allows relative time to be changed in testing to remove time dependency.
-
-
Constructor Detail
-
AdaptiveSampleFilter
public AdaptiveSampleFilter(double sampleRate, Integer targetCount, Integer targetTimeValue, TimeUnit targetTimeUnit)
Initialises the sample filter with a specified initial sample rate and target.- Parameters:
sampleRate
- the initial rate at which to sample requests.targetCount
- the target number of requests to match in a time frame.targetTimeValue
- the value for the time frame.targetTimeUnit
- the unit of the value for the time frame.
-
-
Method Detail
-
sample
public boolean sample()
Description copied from class:SampleFilter
Whether to sample or not.- Overrides:
sample
in classSampleFilter
- Returns:
- true if the request should be sampled, or false otherwise.
-
-