feat(exporter): 增强行数统计功能以支持SQL日志记录

- 在CountRowsFast函数中添加行数统计SQL的日志记录,方便排查估算问题
- 更新前端行数显示逻辑,优化评估状态的处理,确保用户界面友好性
- 提升代码可读性,确保日志记录和行数显示逻辑清晰明了
This commit is contained in:
zhouyonggao 2025-12-17 19:27:29 +08:00
parent 5bb83e1875
commit 646c9e8bc4
2 changed files with 16 additions and 1 deletions

View File

@ -156,6 +156,15 @@ func CountRowsFast(db *sql.DB, ds, main string, filters map[string]interface{})
args = append(args, v) 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...) row := db.QueryRow(q, args...)
var c int64 var c int64
if err := row.Scan(&c); err != nil { if err := row.Scan(&c); err != nil {

View File

@ -67,7 +67,13 @@
<el-table-column label="行数"> <el-table-column label="行数">
<template #default="scope"> <template #default="scope">
{{ 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()
: '评估中')
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="total_rows" label="已写行数"></el-table-column> <el-table-column prop="total_rows" label="已写行数"></el-table-column>