feat(access-logs): 优化概览饼图布局并在查询出错时增加日志记录

- 将设备类型与状态码饼图的断点由 xl 降为 lg,在大屏/笔记本视口下保持双列展示
- 修复 valueCountDistribution 在 ClickHouse 查询出错时静默吞掉错误的缺陷,引入 logger.ErrorF 捕获
- 补充 unreleased 变更日志
This commit is contained in:
ryan
2026-07-18 21:41:52 +08:00
parent e49078ac3b
commit bf71bc540b
6 changed files with 109 additions and 71 deletions
@@ -221,12 +221,16 @@ func ValueCountsNodeAccessLogs(ctx context.Context, filter NodeAccessLogFilter,
}
clause, args := buildNodeAccessLogFilterClause(filter)
tableName := nodeAccessLogTableName()
filterExpr := valueExpr + " != ''"
if col == nodeAccessLogColumnStatusCode {
filterExpr = "status_code >= 0"
}
sql := fmt.Sprintf(`
SELECT %s AS value, count() AS count
FROM %s
WHERE %s AND %s != ''
WHERE %s AND %s
GROUP BY value
ORDER BY count DESC, value ASC`, valueExpr, tableName, clause, valueExpr)
ORDER BY count DESC, value ASC`, valueExpr, tableName, clause, filterExpr)
if limit > 0 {
sql += clickHouseLimitClause
args = append(args, limit)