Class PercentileTracker.Builder<B,T>
- java.lang.Object
-
- com.datastax.driver.core.PercentileTracker.Builder<B,T>
-
- Type Parameters:
B- the type of the concrete builder implementation.T- the type of the object to build.
- Direct Known Subclasses:
ClusterWidePercentileTracker.Builder,PerHostPercentileTracker.Builder
- Enclosing class:
- PercentileTracker
public abstract static class PercentileTracker.Builder<B,T> extends Object
Base class forPercentileTrackerimplementation builders.
-
-
Field Summary
Fields Modifier and Type Field Description protected longhighestTrackableLatencyMillisprotected longintervalMsprotected intminRecordedValuesprotected intnumberOfSignificantValueDigits
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Tbuild()Builds thePercentileTrackerinstance configured with this builder.protected abstract Bself()BwithInterval(long interval, TimeUnit unit)Sets the time interval over which samples are recorded.BwithMinRecordedValues(int minRecordedValues)Sets the minimum number of values that must be recorded for a host before we consider the sample size significant.BwithNumberOfSignificantValueDigits(int numberOfSignificantValueDigits)Sets the number of significant decimal digits to which histograms will maintain value resolution and separation.
-
-
-
Method Detail
-
self
protected abstract B self()
-
withNumberOfSignificantValueDigits
public B withNumberOfSignificantValueDigits(int numberOfSignificantValueDigits)
Sets the number of significant decimal digits to which histograms will maintain value resolution and separation. This must be an integer between 0 and 5.If not set explicitly, this value defaults to 3.
See the HdrHistogram Javadocs for a more detailed explanation on how this parameter affects the resolution of recorded samples.
- Parameters:
numberOfSignificantValueDigits- the new value.- Returns:
- this builder.
-
withMinRecordedValues
public B withMinRecordedValues(int minRecordedValues)
Sets the minimum number of values that must be recorded for a host before we consider the sample size significant.If this count is not reached during a given interval,
PercentileTracker.getLatencyAtPercentile(Host, Statement, Exception, double)will return a negative value, indicating that statistics are not available. In particular, this is true during the first interval.If not set explicitly, this value default to 1000.
- Parameters:
minRecordedValues- the new value.- Returns:
- this builder.
-
withInterval
public B withInterval(long interval, TimeUnit unit)
Sets the time interval over which samples are recorded.For each host, there is a "live" histogram where current latencies are recorded, and a "cached", read-only histogram that is used when clients call
PercentileTracker.getLatencyAtPercentile(Host, Statement, Exception, double). Each time the cached histogram becomes older than the interval, the two histograms are switched. Note that statistics will not be available during the first interval at cluster startup, since we don't have a cached histogram yet.If not set explicitly, this value defaults to 5 minutes.
- Parameters:
interval- the new interval.unit- the unit that the interval is expressed in.- Returns:
- this builder.
-
build
public abstract T build()
Builds thePercentileTrackerinstance configured with this builder.- Returns:
- the instance.
-
-