@@ -45,31 +53,39 @@ export function RankChart({
}
return (
-
+
{items.map((item) => {
const ratio = maxValue > 0 ? (item.value / maxValue) * 100 : 0;
return (
-
-
-
- {item.label}
-
-
+
+
+ {item.label}
+
+
+
+
{valueFormatter(item.value)}
-
);
})}
diff --git a/internal/apps/openflare/observability/access_log_logics.go b/internal/apps/openflare/observability/access_log_logics.go
index 634d3c4c..bc27af77 100644
--- a/internal/apps/openflare/observability/access_log_logics.go
+++ b/internal/apps/openflare/observability/access_log_logics.go
@@ -10,6 +10,7 @@ import (
"github.com/Rain-kl/Wavelet/internal/model"
analyticsrepo "github.com/Rain-kl/Wavelet/internal/repository/analytics"
+ "github.com/Rain-kl/Wavelet/pkg/logger"
)
const (
@@ -236,10 +237,10 @@ type AccessLogCleanupResult struct {
}
const (
- defaultAccessLogOverviewHours = 24
- maxAccessLogOverviewHours = 24 * 30
- accessLogOverviewTopLimit = 10
- accessLogOverviewUASampleLimit = 200
+ defaultAccessLogOverviewHours = 24
+ maxAccessLogOverviewHours = 24 * 30
+ accessLogOverviewTopLimit = 10
+ accessLogOverviewUASampleLimit = 200
)
// GetAccessLogOverview returns summary metrics, trends, and top rankings.
@@ -310,7 +311,11 @@ func valueCountDistribution(
limit int,
) []DistributionItem {
rows, err := model.ValueCountsOpenFlareAccessLogs(ctx, query, column, limit)
- if err != nil || len(rows) == 0 {
+ if err != nil {
+ logger.ErrorF(ctx, "[AccessLog] ValueCountsOpenFlareAccessLogs failed for column %s: %v", column, err)
+ return []DistributionItem{}
+ }
+ if len(rows) == 0 {
return []DistributionItem{}
}
items := make([]DistributionItem, 0, len(rows))
diff --git a/internal/repository/analytics/node_access_log.go b/internal/repository/analytics/node_access_log.go
index d0a8a661..a53ca80a 100644
--- a/internal/repository/analytics/node_access_log.go
+++ b/internal/repository/analytics/node_access_log.go
@@ -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)