Class QueryLogger.DynamicThresholdQueryLogger

  • All Implemented Interfaces:
    LatencyTracker
    Enclosing class:
    QueryLogger

    public static class QueryLogger.DynamicThresholdQueryLogger
    extends QueryLogger
    A QueryLogger that uses a dynamic threshold in milliseconds to track slow queries.

    Dynamic thresholds are based on per-host latency percentiles, as computed by PercentileTracker.

    • Method Detail

      • getPercentileLatencyTracker

        public PercentileTracker getPercentileLatencyTracker()
        Return the percentile tracker to use for recording per-host latency histograms. Cannot be null.
        Returns:
        the percentile tracker to use.
      • setPercentileLatencyTracker

        public void setPercentileLatencyTracker​(PercentileTracker percentileLatencyTracker)
        Set the percentile tracker to use for recording per-host latency histograms. Cannot be null.
        Parameters:
        percentileLatencyTracker - the percentile tracker instance to use.
        Throws:
        IllegalArgumentException - if percentileLatencyTracker == null.
      • getSlowQueryLatencyThresholdPercentile

        public double getSlowQueryLatencyThresholdPercentile()
        Return the threshold percentile beyond which queries are considered 'slow' and logged as such by the driver. The default value is QueryLogger.DEFAULT_SLOW_QUERY_THRESHOLD_PERCENTILE.
        Returns:
        threshold percentile beyond which queries are considered 'slow' and logged as such by the driver.
      • setSlowQueryLatencyThresholdPercentile

        public void setSlowQueryLatencyThresholdPercentile​(double slowQueryLatencyThresholdPercentile)
        Set the threshold percentile beyond which queries are considered 'slow' and logged as such by the driver.
        Parameters:
        slowQueryLatencyThresholdPercentile - Slow queries threshold percentile. It must be comprised between 0 inclusive and 100 exclusive.
        Throws:
        IllegalArgumentException - if slowQueryLatencyThresholdPercentile < 0 || slowQueryLatencyThresholdPercentile >= 100.
      • maybeLogSlowQuery

        protected void maybeLogSlowQuery​(Host host,
                                         Statement statement,
                                         long latencyMs,
                                         long threshold)