Class DefaultLatencyHistogramStatistic

    • Field Detail

      • timeSupplier

        private final java.util.function.LongSupplier timeSupplier
      • pruningDelay

        private final long pruningDelay
      • nextPruning

        private long nextPruning
    • Constructor Detail

      • DefaultLatencyHistogramStatistic

        public DefaultLatencyHistogramStatistic​(double phi,
                                                int bucketCount,
                                                java.time.Duration window,
                                                java.util.function.LongSupplier timeSupplier)
        Create a histogram maintained over a sliding time window.

        The constructed histogram is:

        • maintained over window sliding window
        • consists of bucketCount buckets
        • where b1.size() ~= b0.size * phi
        If "phi" is high, the quantile bounds will be more precise for lower percentiles such as minimum. If "phi" is low, the quantile bounds will be more precise for higher percentiles such as 99%-ile, maximum.
        Parameters:
        phi - histogram bucket bias factor
        bucketCount - number of buckets
        window - sliding window size, in ns
        timeSupplier - the supplier of time, which must be in the same unit as the time passed to the {event(long, long)} method.
      • DefaultLatencyHistogramStatistic

        public DefaultLatencyHistogramStatistic​(double phi,
                                                int bucketCount,
                                                java.time.Duration window)
    • Method Detail

      • minimum

        public java.lang.Long minimum()
        Specified by:
        minimum in interface LatencyHistogramQuery
        Returns:
        The minimum value or null if no value
      • maximum

        public java.lang.Long maximum()
        Specified by:
        maximum in interface LatencyHistogramQuery
        Returns:
        The maximum value or null if no value
      • percentile

        public java.lang.Long percentile​(double percent)
        Specified by:
        percentile in interface LatencyHistogramQuery
        Parameters:
        percent - the percentage (0.0-1.0)
        Returns:
        the value below which percent% of the observations may be found. Will return the upper bound of the approximated range.
      • percentileBounds

        public long[] percentileBounds​(double percent)
        Specified by:
        percentileBounds in interface LatencyHistogramQuery
        Parameters:
        percent - the percentage (0.0-1.0)
        Returns:
        the inclusive bounds (min and max) representing the range containing the right value for the given percent%-ile.
      • event

        public void event​(long time,
                          long latency)
        Description copied from interface: ChainedEventObserver
        Called to indicate an event happened.
        Specified by:
        event in interface ChainedEventObserver
        Parameters:
        time - the clock at event completion in ns
        latency - the event latency in ns
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • tryExpire

        private void tryExpire​(boolean force,
                               java.util.function.LongSupplier time)
      • nullOrVal

        private static java.lang.Long nullOrVal​(double val)