Skip to content

feat: 采集 Kafka 指标 - #235

Merged
githublaohu merged 11 commits into
apache:dev-maven-releasefrom
SwimmingLiu:dev-maven-release
Nov 1, 2026
Merged

githublaohu merged 11 commits into
apache:dev-maven-releasefrom
SwimmingLiu:dev-maven-release

Conversation

@SwimmingLiu

@SwimmingLiu SwimmingLiu commented Oct 11, 2026 •

Copy link
Copy Markdown

Motivation

为 Kafka 集群接入指标采集,复用已有的元数据同步、任务调度和报表存储流程。

Modifications

  • 在 CollectManage 的公共缓存和任务表中注册 Kafka 采集器,处理集群、节点和配置的启停及归属变化。Kafka 采集配置使用 EVENTMESH 模式,节点 JMX 采集需要配置端口。
  • 使用 Admin API 采集集群、Topic、分区和消费组指标,使用 JMX 采集 Broker 流量和健康指标。JMX 连接、数值读取、分组和采集状态由公共基类提供,数值不可用时使用 -1。
  • 复用公共批次整理和维度补齐,在写入扩展点将 Kafka 样本转换为普通列表;IoTDB 使用参数绑定写入,其他引擎沿用现有写入接口。
  • 在采集配置读取处处理整数启用状态和空 JMX 端口,保留通用行映射及已有采集器的实现。

Validation

  • Java 17:Kafka 采集、注册和交付专项 93 项通过;Kafka 元数据 17 项、Kafka core mock 62 项通过。后端打包和 Checkstyle 通过。
  • 隔离的 KRaft 和 ZooKeeper 环境各通过两项 MySQL 元数据同步、Kafka/JMX 采集与 IoTDB 写入回读测试;另有三项真实 MySQL 节点迁移状态测试通过。
  • 原有 RocketMQ 与公共批次测试在候选和参考提交上逐项结果一致:29 项通过、1 项失败、2 项错误、2 项跳过。旧 console 安全隔离对照的 164 项结果一致;该对照在临时副本增加 JUnit 4 支持并适配五份旧测试源码,部分依赖外部服务的集成测试未纳入。
  • 两项隔离 RocketMQ 真实服务测试在候选和参考提交上均因同一指标集合断言失败;其中 IoTDB 用例未执行到写入回读。
  • 启用全部 Java 测试源码编译时,候选和参考提交 52c012e 均被 core 模块同样的 7 处旧编译错误阻断;不能称为全量 Java 测试通过。
  • 前端构建通过。原始 Jest 命令在 ECharts ESM 加载阶段失败;前端源码与参考提交一致。
  • 先前的隔离启动诊断中,默认 classpath 因缺少 decoration-javax 而启动失败;临时补充该依赖后启动成功。该诊断未在本次提交上重跑。

Limitation

JMX 共享后台池最多容纳 20 个阻塞请求。若不同端点的调用永久阻塞并占满线程池,其他节点的 JMX 采样会被拒绝,直到有请求结束或进程重启;Kafka Admin 采集不使用该线程池。

采集配置迁移到非 Kafka 集群并同时停用或删除时,旧删除逻辑可能清理目标集群的其他采集任务;该问题在参考提交也可复现。

Copilot AI balanced review requested due to automatic review settings October 11, 2026 07:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

合并 console POM 中重复的顶层 profiles,避免 Maven 在读取项目时失败。
保留四个 profile 和原有 build 配置,仅调整容器结构并说明原因。

验证:Java 17 下 validate 和 package -DskipTests 均通过。
Register Admin and JMX tasks through the shared metadata cache and collector factories.
Keep result batches safe for concurrent completion, bind IoTDB parameters,
preserve Kafka tags, and return each report by name.

Cover connection and read deadlines, schema constraints, real KRaft and
ZooKeeper collection, HTTP queries, and RocketMQ compatibility.
Remove the new servlet adapter dependency and connect existing result,
exception and QueryClause interfaces to Spring 5 servlet APIs.

Keep JSON response media types concrete, honor the public CORS switch,
and clear pagination state even when preHandle fails. Verify persisted
Kafka data through the real MVC configuration in both Kafka modes.
Preserve the Kafka collection lifecycle while adopting separate status
and logical deletion fields. Exclude stopped brokers from Kafka tasks.

Validate Kafka collection and metadata in KRaft and ZooKeeper modes,
API behavior, MySQL model contracts, RocketMQ compatibility, Checkstyle,
and the backend package.
@githublaohu
githublaohu merged commit 1183b65 into apache:dev-maven-release Nov 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants