From 646c9e8bc4dd378728f9ec7c3a39a11e6c8828c6 Mon Sep 17 00:00:00 2001
From: zhouyonggao <1971162852@qq.com>
Date: Wed, 17 Dec 2025 19:27:29 +0800
Subject: [PATCH] =?UTF-8?q?feat(exporter):=20=E5=A2=9E=E5=BC=BA=E8=A1=8C?=
=?UTF-8?q?=E6=95=B0=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD=E4=BB=A5=E6=94=AF?=
=?UTF-8?q?=E6=8C=81SQL=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在CountRowsFast函数中添加行数统计SQL的日志记录,方便排查估算问题
- 更新前端行数显示逻辑,优化评估状态的处理,确保用户界面友好性
- 提升代码可读性,确保日志记录和行数显示逻辑清晰明了
---
server/internal/exporter/stream.go | 9 +++++++++
web/index.html | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/server/internal/exporter/stream.go b/server/internal/exporter/stream.go
index e2550d7..c837666 100644
--- a/server/internal/exporter/stream.go
+++ b/server/internal/exporter/stream.go
@@ -156,6 +156,15 @@ func CountRowsFast(db *sql.DB, ds, main string, filters map[string]interface{})
args = append(args, v)
}
}
+ // 记录行数统计 SQL,方便排查估算问题
+ logging.JSON("INFO", map[string]interface{}{
+ "event": "count_fast_query",
+ "datasource": ds,
+ "main": main,
+ "sql": q,
+ "args": args,
+ "filters": filters,
+ })
row := db.QueryRow(q, args...)
var c int64
if err := row.Scan(&c); err != nil {
diff --git a/web/index.html b/web/index.html
index 1102cd0..1edb694 100644
--- a/web/index.html
+++ b/web/index.html
@@ -67,7 +67,13 @@
- {{ Number(scope.row.row_estimate||0) > 0 ? Number(scope.row.row_estimate||0) : '评估中' }}
+ {{
+ scope.row.eval_status
+ ? Number(scope.row.row_estimate || 0).toLocaleString()
+ : (Number(scope.row.row_estimate || 0) > 0
+ ? Number(scope.row.row_estimate || 0).toLocaleString()
+ : '评估中')
+ }}