From 817e1552acfa124c2cf17a6b84569681ea47b897 Mon Sep 17 00:00:00 2001 From: raja <1647193241@qq.com> Date: Wed, 15 Jan 2025 22:37:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=84=E5=88=99=E5=AE=A1=E8=AE=A1-?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E6=96=B0=E5=A2=9E/=E7=BC=96=E8=BE=91-?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20--story=3D121513458?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【新增】 1. 审计策略支持实时维表 --- src/backend/services/web/analyze/constants.py | 1 + .../services/web/analyze/controls/rule_audit.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/backend/services/web/analyze/constants.py b/src/backend/services/web/analyze/constants.py index 133c497e..1947b549 100644 --- a/src/backend/services/web/analyze/constants.py +++ b/src/backend/services/web/analyze/constants.py @@ -68,6 +68,7 @@ class FlowDataSourceNodeType(TextChoices): REALTIME = "stream_source", gettext_lazy("RealTime") BATCH = "batch_join_source", gettext_lazy("Batch Join") BATCH_REAL = "batch_source", gettext_lazy("Batch") + REDIS_KV_SOURCE = "redis_kv_source", gettext_lazy("Redis KV") class ResultTableType(TextChoices): diff --git a/src/backend/services/web/analyze/controls/rule_audit.py b/src/backend/services/web/analyze/controls/rule_audit.py index 131a0599..4065b29c 100644 --- a/src/backend/services/web/analyze/controls/rule_audit.py +++ b/src/backend/services/web/analyze/controls/rule_audit.py @@ -65,6 +65,7 @@ from services.web.databus.constants import COLLECTOR_PLUGIN_ID from services.web.databus.models import CollectorPlugin from services.web.strategy_v2.constants import ( + BkBaseStorageType, RuleAuditConfigType, StrategyStatusChoices, ) @@ -150,15 +151,20 @@ def check_source_type(self, result_table_id: str) -> str: data_source = self.strategy.configs["data_source"] source_type = data_source["source_type"] - result_table = api.bk_base.get_result_table(result_table_id=result_table_id) + result_table = api.bk_base.get_result_table(result_table_id=result_table_id, related=["storages"]) # 1. 实时计算&日志:实时流水表 if source_type == FlowDataSourceNodeType.REALTIME and self.event_log_rt_id == result_table_id: return FlowDataSourceNodeType.REALTIME - # 2. 资产表:离线维表 + # 2. 资产表:离线维表/实时维表 elif ( result_table["processing_type"] == ResultTableType.CDC or result_table["result_table_type"] == ResultTableType.STATIC ): + if ( + source_type == FlowDataSourceNodeType.REALTIME + and BkBaseStorageType.REDIS in result_table["storage_types"] + ): + return FlowDataSourceNodeType.REDIS_KV_SOURCE return FlowDataSourceNodeType.BATCH # 3. 离线计算:离线流水表 elif source_type == FlowDataSourceNodeType.BATCH: