Skip to content

[Feature]: 记录远端节点连接生命周期 audit #554

Description

@AptS-1547

背景

当前远端节点的 reverse tunnel 运行日志能够看到连接、关闭、EOF、heartbeat timeout 和重连,但这些生命周期变化没有进入产品 audit。运维可以从日志判断瞬时状态,却无法在管理端按节点、时间和事件类型回溯连接稳定性,也无法把正常下线与异常断线区分开。

目标

为远端节点连接生命周期建立产品级 audit 事件,覆盖以下三类节点级状态转换:

  1. 连接成功:binding control / poll / streaming handshake 使节点从 offline 进入 online,或一次异常断线后的恢复。
  2. 正常下线:收到 WebSocket Close、follower 进程 graceful shutdown、binding 被禁用、transport mode 切换或 owner 正常释放。
  3. 异常断线:payload EOF、connection reset、协议读取失败、heartbeat timeout、owner fencing 或 close handshake 失败。

约束

  • 事件归属 remote node / binding,不按四条 streaming lane 各写一条重复 audit;需要保留 lane 数量、首个 lane 或聚合窗口等诊断上下文时放入结构化 metadata。
  • 事件使用稳定的 action / reason code,区分 connectedgraceful_disconnectunexpected_disconnectheartbeat_timeout 等语义,不把原始日志字符串当作长期 API。
  • 记录 system actor、remote node id、binding id、transport、observed_at、连接 generation / outage generation 和必要的错误分类。
  • access key、secret、签名、完整 URL 中的凭据以及 token 不得进入 audit 明文或 metadata。
  • 重复重连、四 lane 同时 EOF 和多 Primary owner 变化需要幂等/去重,避免一次节点掉线灌入多条相同事件。

验收标准

  • 连接成功、正常下线、异常断线三类事件均能通过 audit repository 查询,并在管理端或现有 audit API 中按 remote node 过滤。
  • graceful Close 不产生异常断线事件;EOF/reset/heartbeat timeout 不被记成正常下线。
  • 四 lane 同时变化只产生一条节点级状态转换事件,并保留可操作的聚合上下文。
  • Primary/follower、single/cluster、direct/reverse/auto transport 下的事件归属一致。
  • 进程重启、binding 禁用、transport 切换和 owner fencing 覆盖成功、失败、重复和恢复路径测试。
  • audit 事件不泄露 access key、secret、signature 或 token。

Metadata

Metadata

Assignees

Labels

Priority: LowLow priority issueScope: Remote NodesPrimary/follower nodes, remote storage targets, and internal routingScope: RuntimeRuntime lifecycle, async execution, tasks, and process-level performance

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions