mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 08:36:37 +08:00
feat(frontend): 观测网络字节字段与 UV 文案对齐
网络图仅使用 bytes_provided/received;看板与节点 UV 改为 24h/查询窗口 独立访客;清理 traffic_reports 与 openresty 吞吐兼容字段;运维清理目标 改为 node_edge_health。
This commit is contained in:
@@ -25,9 +25,9 @@ export type OpenFlareOpsFields = {
|
||||
};
|
||||
|
||||
export const defaultOpenFlareOpsFields: OpenFlareOpsFields = {
|
||||
agent_heartbeat_interval: '10000',
|
||||
agent_heartbeat_interval: '3000',
|
||||
agent_websocket_upgrade_enabled: true,
|
||||
node_offline_threshold: '120000',
|
||||
node_offline_threshold: '60000',
|
||||
agent_update_repo: 'Rain-kl/OpenFlare',
|
||||
geoip_provider: 'ipinfo',
|
||||
server_address: '',
|
||||
@@ -68,12 +68,12 @@ export function mapOptionsToOpsFields(
|
||||
serverAddress = '',
|
||||
): OpenFlareOpsFields {
|
||||
return {
|
||||
agent_heartbeat_interval: optionMap.agent_heartbeat_interval ?? '10000',
|
||||
agent_heartbeat_interval: optionMap.agent_heartbeat_interval ?? '3000',
|
||||
agent_websocket_upgrade_enabled: toBoolean(
|
||||
optionMap.agent_websocket_upgrade_enabled,
|
||||
true,
|
||||
),
|
||||
node_offline_threshold: optionMap.node_offline_threshold ?? '120000',
|
||||
node_offline_threshold: optionMap.node_offline_threshold ?? '60000',
|
||||
agent_update_repo: optionMap.agent_update_repo ?? 'Rain-kl/OpenFlare',
|
||||
geoip_provider: optionMap.geoip_provider ?? 'ipinfo',
|
||||
server_address: optionMap.server_address || serverAddress,
|
||||
@@ -129,12 +129,15 @@ export function buildDiscoveryCommand(
|
||||
export function validateAgentFields(fields: OpenFlareOpsFields) {
|
||||
const heartbeat = Number.parseInt(fields.agent_heartbeat_interval, 10);
|
||||
const offline = Number.parseInt(fields.node_offline_threshold, 10);
|
||||
if (Number.isNaN(heartbeat) || heartbeat < 5000) {
|
||||
throw new Error('心跳间隔不能小于 5000 毫秒。');
|
||||
if (Number.isNaN(heartbeat) || heartbeat < 1000) {
|
||||
throw new Error('心跳间隔不能小于 1000 毫秒。');
|
||||
}
|
||||
if (Number.isNaN(offline) || offline < 10000) {
|
||||
throw new Error('离线阈值不能小于 10000 毫秒。');
|
||||
}
|
||||
if (offline < heartbeat * 3) {
|
||||
throw new Error('离线阈值建议至少为心跳间隔的 3 倍。');
|
||||
}
|
||||
}
|
||||
|
||||
export function validateUptimeKumaFields(fields: OpenFlareOpsFields) {
|
||||
|
||||
@@ -90,10 +90,10 @@ const cleanupTargets: Array<{
|
||||
'清理 node_metric_snapshots,影响节点资源趋势;表 TTL 为 30 天。',
|
||||
},
|
||||
{
|
||||
target: 'node_request_reports',
|
||||
label: '请求聚合',
|
||||
target: 'node_edge_health',
|
||||
label: 'OpenResty 健康',
|
||||
description:
|
||||
'清理 node_request_reports,影响请求量与错误量统计;表 TTL 为 30 天。',
|
||||
'清理 node_edge_health(OpenResty 连接/健康快照);表 TTL 为 30 天。业务流量请清理访问日志。',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user