Skip to content

[v3/v4]主机信息采集侧提供监控接口 #8573

@elizabevil

Description

@elizabevil
背景

CMDB watch 机制进行 MongoDB changestream 监听时存在问题:

  • 游标过期(resume token / clusterTime)导致接口直接报错
  • 不支持“带时间漂移”的查询方式
  • 接口对不同使用人(开发 / 实施)不够友好
  • 缺少错误分类与恢复策略文档(对人员要求高)
目标

提升 watch 监听机制的:

  • 容错性
  • 易用性
  • 使用成本(减少对开发人员的技能要求)
  • 业务可连续性
需求点
游标过期处理优化

当前:

  • 游标过期 → 接口直接报错

期望:

逻辑优先级:游标 > 时间

  1. 若游标有效 → 按游标继续 watch
  2. 若游标无效(过期/找不到) → 自动切换为时间查询
  3. 若时间也不合法 → 返回空(或 error code,但必须可识别)
时间漂移查询支持

新增查询参数drift

参数名 含义 示例值 类型
drift 使用当前时间的 ±N 分钟 作为查询范围,避免错过事件 +10m/-10m string

游标>时间范围 or 当前时间偏移量

错误信息分类(系统 vs 使用者)
新增level字段支持区分错误等级

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions