每个ref游标的Spring日志执行时间

问题描述

Oracle存储过程正在返回多个out参数(引用游标),并且Spring Boot通过SimpleJdbcCall消耗了它们。有时,存储的proc调用会花费30秒以上的时间才能返回数据。

每个ref游标实际上是另一个存储的proc输出,该输出具有很多复杂的查询。因此,在做出任何决定之前想知道它们的执行时间。

我正在尝试使用AOP,但是没有被调用。

@Around("execution(* org.springframework.jdbc.core.ResultSetExtractor.extractData(..))")
    public Object methodTimeLogger(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        MethodSignature methodSignature = (MethodSignature) proceedingJoinPoint.getSignature();

        // Get intercepted method details
        String className = methodSignature.getDeclaringType().getSimpleName();
        String methodName = methodSignature.getName();

        // Measure method execution time
        StopWatch stopWatch = new StopWatch(className + "->" + methodName);
        stopWatch.start(methodName);
        Object result = proceedingJoinPoint.proceed();
        stopWatch.stop();
        // Log method execution time
        if (logger.isInfoEnabled()) {
            logger.info(stopWatch.prettyPrint());
        }
        return result;
    }

是否可以记录每个ref游标的执行时间?建议我任何更好的解决方案。

环境:使用hikari数据源,Oracle进行的春季启动

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...