Class AbstractQueryReport

    • Constructor Detail

      • AbstractQueryReport

        public AbstractQueryReport()
        Constructs a new AbstractQueryReport with the default threshold.
    • Method Detail

      • prepareStatement

        protected abstract void prepareStatement​(java.lang.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​(java.lang.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 java.lang.String reportFailedQuery​(java.lang.String query,
                                                     java.lang.Object[] args,
                                                     java.lang.String name,
                                                     long start,
                                                     long delta,
                                                     java.lang.Throwable t)
        Invoked when a query execution, a call to an execute method as recognised by AbstractCreateStatementInterceptor.isExecute(Method, boolean), 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, as recognised by AbstractCreateStatementInterceptor.isExecute(Method, boolean)
        start - the wall clock time the query execution started
        delta - the time the execution took before it failed, measured with the monotonic clock
        t - the exception that happened
        Returns:
        - the SQL that was executed or the string "batch" if it was a batch execution, or null if the invocation carries no SQL string
      • reportQuery

        protected java.lang.String reportQuery​(java.lang.String query,
                                               java.lang.Object[] args,
                                               java.lang.String name,
                                               long start,
                                               long delta)
        Invoked when a query execution, a call to an execute method as recognised by AbstractCreateStatementInterceptor.isExecute(Method, boolean), succeeded and was within the timing threshold
        Parameters:
        query - the query that was executed
        args - the arguments to the execution
        name - the name of the method used to execute, as recognised by AbstractCreateStatementInterceptor.isExecute(Method, boolean)
        start - the wall clock time the query execution started
        delta - the time the execution took, measured with the monotonic clock
        Returns:
        - the SQL that was executed or the string "batch" if it was a batch execution, or null if the invocation carries no SQL string
      • reportSlowQuery

        protected java.lang.String reportSlowQuery​(java.lang.String query,
                                                   java.lang.Object[] args,
                                                   java.lang.String name,
                                                   long start,
                                                   long delta)
        Invoked when a query execution, a call to an execute method as recognised by AbstractCreateStatementInterceptor.isExecute(Method, boolean), succeeded and exceeded the timing threshold
        Parameters:
        query - the query that was executed
        args - the arguments to the execution
        name - the name of the method used to execute, as recognised by AbstractCreateStatementInterceptor.isExecute(Method, boolean)
        start - the wall clock time the query execution started
        delta - the time the execution took, measured with the monotonic clock
        Returns:
        - the SQL that was executed or the string "batch" if it was a batch execution, or null if the invocation carries no SQL string
      • getThreshold

        public long getThreshold()
        returns the query measure threshold. This value is in milliseconds. A successful execution that takes longer than this threshold is reported as a slow query; see setThreshold(long) for the meaning of a negative value and for the handling of failed executions.
        Returns:
        the threshold in milliseconds
      • createStatement

        public java.lang.Object createStatement​(java.lang.Object proxy,
                                                java.lang.reflect.Method method,
                                                java.lang.Object[] args,
                                                java.lang.Object statement,
                                                long time)
        Wraps a newly created statement in a proxy that measures its executions, so they can be reported as measured, slow or failed queries.
        Specified by:
        createStatement in class AbstractCreateStatementInterceptor
        Parameters:
        proxy - the actual proxy object
        method - the method that was called. It will be one of the methods defined in AbstractCreateStatementInterceptor.STATEMENT_TYPES
        args - the arguments to the method
        statement - the statement that the underlying connection created
        time - elapsed time in milliseconds, measured with the monotonic clock
        Returns:
        a Statement object