修复节点详情 OpenResty 连接数与吞吐显示为「—」:节点可观测 API 将 OpenResty 观测数据合并进 metric_snapshots;指标文案改为「请求/分钟」(近 60 秒窗口),连接数为 0 时正常显示 0。

This commit is contained in:
ryan
2026-06-21 10:52:06 +08:00
parent 42896a8473
commit 6e86901a58
9 changed files with 344 additions and 165 deletions
@@ -1,10 +1,4 @@
import type {
ApplyResult,
NodeItem,
NodeStatus,
NodeTrafficReport,
OpenrestyStatus,
} from '@/lib/services/openflare';
import type {ApplyResult, NodeItem, NodeStatus, NodeTrafficReport, OpenrestyStatus,} from '@/lib/services/openflare';
export const WS_CONNECTED_LAST_SEEN = '__OPENFLARE_WS_CONNECTED__';
export const FLARED_WS_CONNECTED_LAST_SEEN = '__OPENFLARE_FLARED_WS_CONNECTED__';
@@ -176,6 +170,13 @@ export function formatPercent(value?: number | null) {
return `${value.toFixed(1)}%`;
}
export function formatMetricCount(value?: number | null) {
if (value === undefined || value === null || !Number.isFinite(value)) {
return '—';
}
return value.toLocaleString('zh-CN');
}
export function formatBytesPerSecond(
value?: number | null,
windowSeconds = 1,