Class PercentileTracker.Builder<B,​T>

    • Field Detail

      • highestTrackableLatencyMillis

        protected final long highestTrackableLatencyMillis
      • numberOfSignificantValueDigits

        protected int numberOfSignificantValueDigits
      • minRecordedValues

        protected int minRecordedValues
      • intervalMs

        protected long intervalMs
    • 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 the PercentileTracker instance configured with this builder.
        Returns:
        the instance.