From 99232da12df0e82d052a75d14177dc7ef4d10a52 Mon Sep 17 00:00:00 2001 From: wenyh1 <2365151147@qq.com> Date: Thu, 23 May 2024 10:33:20 +0800 Subject: [PATCH] [inner-2390] fix: sqlSlowTime does not take effect --- .../com/actiontech/dble/statistic/trace/TraceResult.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/actiontech/dble/statistic/trace/TraceResult.java b/src/main/java/com/actiontech/dble/statistic/trace/TraceResult.java index 6ff243ae96..62a7d2c4c5 100644 --- a/src/main/java/com/actiontech/dble/statistic/trace/TraceResult.java +++ b/src/main/java/com/actiontech/dble/statistic/trace/TraceResult.java @@ -285,7 +285,7 @@ public void setResponseTime(boolean isSuccess, long time, long timeMs) { schema, sql, sqlType, currentSession.getShardingService().getTxId(), examinedRows, sqlRows, netOutBytes, resultSize, requestEnd, requestEndMs, new ArrayList(tableList)); StatisticManager.getInstance().push(f); - if (isDetailTrace) { + if (isDetailTrace && getOverAllMilliSecond() > SlowQueryLog.getInstance().getSlowTime()) { SlowQueryLog.getInstance().putSlowQueryLog(currentSession.getShardingService(), this.clone()); } if (LOGGER.isDebugEnabled()) { @@ -453,6 +453,10 @@ public SqlTraceType getType() { return this.type; } + public double getOverAllMilliSecond() { + return (double) (this.requestEnd - this.requestStart) / 1000000000; + } + public String getOverAllSecond() { double milliSecond = (double) (this.requestEnd - this.requestStart) / 1000000000; return String.format("%.6f", milliSecond);