-
Notifications
You must be signed in to change notification settings - Fork 119
feat: 修改ClusterInfo的逻辑,添加新的字段,使其自定义匹配 --story=129487981 #9315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: 修改ClusterInfo的逻辑,添加新的字段,使其自定义匹配 --story=129487981 #9315
Conversation
|
请在 PR 中添加类型标签,例如: |
|
请在 PR 中添加项目标签,例如: |
|
请在 PR 中添加项目标签,例如: |
|
请在 PR 中添加类型标签,例如: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
✓ 代码评审按照 .github/copilot-instructions.md 中定义的指南进行。
本 PR 为 ClusterInfo 模型添加了基于标签的智能集群匹配功能,支持根据业务 ID 和数据类型自动路由到合适的存储集群。
主要变更包括:
- 在
ClusterInfo模型中添加labelsJSONField,支持按业务 ID 和数据类型配置路由规则 - 实现了智能匹配逻辑,包括 4 级优先级匹配(精确匹配 > 业务匹配 > 类型匹配 > 兜底匹配)
- 集成到 Redis、Kafka、ES、Argus 和 Doris 存储的
create_table方法中,替换原有的默认集群查询逻辑
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| bkmonitor/metadata/models/storage.py | 添加 labels 字段到 ClusterInfo 模型,实现 get_matched_cluster() 和 _match_cluster_labels() 方法,并修改各存储类型的 create_table() 方法以使用新的集群匹配逻辑 |
| bkmonitor/metadata/models/result_table.py | 在 ResultTable 类中添加 get_data_type_by_data_id() 和 get_biz_id_by_table_id() 辅助方法,用于从 table_id 解析数据类型和业务 ID |
| bkmonitor/metadata/management/commands/query_cluster.py | 新增管理命令,用于查询指定业务/数据类型匹配的集群 |
| bkmonitor/metadata/management/commands/migrate_cluster.py | 新增管理命令,用于将旧集群的标签配置迁移到新集群 |
| bkmonitor/metadata/management/commands/assign_cluster.py | 新增管理命令,用于为集群分配或修改业务 ID 和数据类型标签 |
|
请在 PR 中添加项目标签,例如: |
|
请在 PR 中添加类型标签,例如: |
|
请在 PR 中添加项目标签,例如: |
|
请在 PR 中添加类型标签,例如: |
|
请在 PR 中添加类型标签,例如: |
|
请在 PR 中添加项目标签,例如: |
|
请在 PR 中添加项目标签,例如: |
|
请在 PR 中添加类型标签,例如: |
No description provided.