Class AbstractQueryReport

    • Field Detail

      • threshold

        protected long threshold
        The threshold in milliseconds. If the query is faster than this, we don't measure it
    • Constructor Detail

      • AbstractQueryReport

        public AbstractQueryReport()
    • Method Detail

      • prepareStatement

        protected abstract void prepareStatement​(String sql,
                                                 long time)
        Invoked when prepareStatement has been called and completed.
        Parameters:
        sql - - the string used to prepare the statement with
        time - - the time it took to invoke prepare
      • prepareCall

        protected abstract void prepareCall​(String query,
                                            long time)
        Invoked when prepareCall has been called and completed.
        Parameters:
        query - - the string used to prepare the statement with
        time - - the time it took to invoke prepare
      • reportFailedQuery

        protected String reportFailedQuery​(String query,
                                           Object[] args,
                                           String name,
                                           long start,
                                           Throwable t)
        Invoked when a query execution, a call to execute/executeQuery or executeBatch failed.
        Parameters:
        query - the query that was executed and failed
        args - the arguments to the execution
        name - the name of the method used to execute AbstractCreateStatementInterceptor.isExecute(Method, boolean)
        start - the time the query execution started
        t - the exception that happened
        Returns:
        - the SQL that was executed or the string "batch" if it was a batch execution
      • reportQuery

        protected String reportQuery​(String query,
                                     Object[] args,
                                     String name,
                                     long start,
                                     long delta)
        Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was within the timing threshold
        Parameters:
        query - the query that was executed and failed
        args - the arguments to the execution
        name - the name of the method used to execute AbstractCreateStatementInterceptor.isExecute(Method, boolean)
        start - the time the query execution started
        delta - the time the execution took
        Returns:
        - the SQL that was executed or the string "batch" if it was a batch execution
      • reportSlowQuery

        protected String reportSlowQuery​(String query,
                                         Object[] args,
                                         String name,
                                         long start,
                                         long delta)
        Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing threshold
        Parameters:
        query - the query that was executed and failed
        args - the arguments to the execution
        name - the name of the method used to execute AbstractCreateStatementInterceptor.isExecute(Method, boolean)
        start - the time the query execution started
        delta - the time the execution took
        Returns:
        - the SQL that was executed or the string "batch" if it was a batch execution
      • getThreshold

        public long getThreshold()
        returns the query measure threshold. This value is in milliseconds. If the query is faster than this threshold than it wont be accounted for
        Returns:
        the threshold in milliseconds
      • setThreshold

        public void setThreshold​(long threshold)
        Sets the query measurement threshold. The value is in milliseconds. If the query goes faster than this threshold it will not be recorded.
        Parameters:
        threshold - set to -1 to record every query. Value is in milliseconds.