feat(metadata): 支持自定义格式 DataSource 与多 DataLink --story=137268681 - #12026
Open
unique0lai wants to merge 4 commits into
Open
feat(metadata): 支持自定义格式 DataSource 与多 DataLink --story=137268681#12026unique0lai wants to merge 4 commits into
unique0lai wants to merge 4 commits into
Conversation
|
请在 PR 中添加项目标签,例如: |
Contributor
There was a problem hiding this comment.
Pull request overview
本 PR 为 bk-monitor 的 metadata 模块新增了 bk_custom_format 清洗类型,允许同一个 DataSource 派生出多条独立的 VM / Elasticsearch / Doris DataLink。VM 目标采用 Clean → ChannelBinding → AvroToMetric 两段式链路(clean + shipper 两条 Databus、独立 consumer group),ES/Doris 目标采用单段直连链路。同时引入稳定的链路命名、失败状态记录(status_message)、完整生命周期清理,以及无状态的 Clean Debug 接口与字段契约校验,并配套数据库迁移与回归测试。
Changes:
- 新增
CustomFormatV4DataLinkOption、ChannelBindingConfig模型与compose_custom_format_configs组装逻辑,支持 VM/ES/Doris 单目标链路及字段契约校验。 - 扩展
DataBusConfig(source_kind/source_name/role)与BkBaseResultTable(status_message、去除bkbase_data_name唯一约束),并新增迁移0276。 - 打通 DataSource/ResultTable 全生命周期:注册命名空间处理、一对多关联、KafkaTail 采样、健康检查、失败清理与 Debug 接口。
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
metadata/task/datalink.py |
新增 compose_custom_format_data_link_name、apply_custom_format_datalink 任务及 VM 依赖解析 |
metadata/task/bkbase.py |
Databus 角色反推、ChannelBinding 同步、status_message 清理与去除单一 DSRT 假设 |
metadata/models/data_link/data_link.py |
新增自定义格式策略、契约校验、compose_custom_format_configs,delete_data_link 按租户/命名空间过滤 |
metadata/models/data_link/data_link_configs.py |
新增 ChannelBindingConfig,Databus 增加 source/role 字段并模板化 source |
metadata/models/result_table.py |
新增 Option、CustomFormatV4DataLinkOption、apply/delete/modify/存储创建的自定义格式分支 |
metadata/models/data_source.py |
注册命名空间参数化、modify_table_id_datasource 支持一对多、禁止原地切换 ETL |
metadata/models/bkdata/result_table.py |
去除 bkbase_data_name 唯一约束并新增 status_message |
metadata/resources/custom_format_datalink.py |
新增 Clean Debug 资源 |
metadata/resources/resources.py |
KafkaTail 支持自定义格式采样路径 |
metadata/resources/bkdata_link.py |
元数据反查纳入 ChannelBinding,Databus 入口优先展示 clean |
metadata/health_check.py |
自定义格式按 DataIdConfig 解析命名空间 |
metadata/models/space/constants.py / data_link/constants.py / config/default.py |
新增枚举、Kind、inner Kafka channel 映射配置 |
metadata/migrations/0276_custom_format_datalink.py |
配套 schema 迁移 |
metadata/models/**/__init__.py、component_reuse.py |
导出 ChannelBindingConfig |
metadata/tests/** |
自定义格式链路、KafkaTail、DataLink 回归测试 |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| DataLink._validate_custom_format_contract( | ||
| generate_result_table_field_list(table_id=table_id, bk_tenant_id=bk_tenant_id), | ||
| clean_rules, | ||
| require_vm_contract=option.target_storage_type == "victoria_metrics", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更内容
bk_custom_formatETL 类型及 ResultTable 自定义清洗配置验证
关联单据:137268681