fix(openflare): ClickHouse count scan and dashboard traffic metrics

- Scan ClickHouse count()/countIf() aggregates as uint64 before int64 conversion
- Fix access log list count, region stats, and delete pre-count queries
- Aggregate dashboard 24h traffic totals from hourly trend buckets
- Show current hour value in traffic trend chart summary
- Rename docker-compose service to openflare
- Remove redundant config preview section from performance page
This commit is contained in:
ryan
2026-06-19 17:34:19 +08:00
parent 9491b2a744
commit 3187934f72
14 changed files with 281 additions and 88 deletions
@@ -30,6 +30,8 @@ export function TrafficTrendChart({
<CardContent>
<TrendChart
labels={points.map((point) => formatTrendHour(point.bucket_started_at))}
summaryScope="last-point"
summaryHint="当前小时"
series={[
{
label: '请求量',
+1 -26
View File
@@ -16,7 +16,7 @@ import {Input} from "@/components/ui/input"
import {Label} from "@/components/ui/label"
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue,} from "@/components/ui/select"
import {Switch} from "@/components/ui/switch"
import {ConfigVersionService, OptionService} from "@/lib/services/openflare"
import {OptionService} from "@/lib/services/openflare"
import {
defaultPerformanceFields,
@@ -44,12 +44,6 @@ export default function PerformancePage() {
enabled: !!user?.is_admin,
})
const previewQuery = useQuery({
queryKey: ["openflare", "config-preview"],
queryFn: () => ConfigVersionService.preview(),
enabled: !!user?.is_admin,
})
useEffect(() => {
if (!optionsQuery.data) return
setFields(mapOptionsToFields(optionsToMap(optionsQuery.data)))
@@ -154,25 +148,6 @@ export default function PerformancePage() {
</Button>
</div>
<div className="grid gap-3 sm:grid-cols-3">
<div className="rounded-lg border border-dashed px-4 py-3">
<p className="text-[10px] uppercase tracking-wider text-muted-foreground">发布链路</p>
<p className="mt-2 text-sm font-medium">受管模板渲染</p>
</div>
<div className="rounded-lg border border-dashed px-4 py-3">
<p className="text-[10px] uppercase tracking-wider text-muted-foreground">预览规则数</p>
<p className="mt-2 text-sm font-semibold">
{previewQuery.data?.route_count ?? "—"} 条
</p>
</div>
<div className="rounded-lg border border-dashed px-4 py-3">
<p className="text-[10px] uppercase tracking-wider text-muted-foreground">配置预览</p>
<p className="mt-2 text-sm text-muted-foreground">
在配置发布页查看完整 nginx 渲染结果
</p>
</div>
</div>
<Card className="border-dashed shadow-none">
<CardHeader className="flex flex-row items-center justify-between">
<div>