Skip to content

Commit 1cf1bc3

Browse files
authored
feat: unify-query 关联关系修正实体关键维度定义 --story=129547583 (#1158)
1 parent f126c9a commit 1cf1bc3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

pkg/unify-query/cmdb/v1beta1/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,19 @@ var configData = &Config{
147147
{
148148
Name: "business",
149149
Index: cmdb.Index{
150-
"biz_id",
150+
"bk_biz_id",
151151
},
152152
},
153153
{
154154
Name: "set",
155155
Index: cmdb.Index{
156-
"set_id",
156+
"bk_set_id",
157157
},
158158
},
159159
{
160160
Name: "module",
161161
Index: cmdb.Index{
162-
"module_id",
162+
"bk_module_id",
163163
},
164164
},
165165
{
@@ -179,7 +179,7 @@ var configData = &Config{
179179
{
180180
Name: "host",
181181
Index: cmdb.Index{
182-
"host_id",
182+
"bk_host_id",
183183
},
184184
Info: cmdb.Index{
185185
"version",

pkg/unify-query/cmdb/v1beta1/query_maker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func TestMakeQuery(t *testing.T) {
115115
"namespace": "ns1",
116116
"bcs_cluster_id": "cluster1",
117117
},
118-
promQL: `(count by (host_id) (bkmonitor:host_with_system_relation{bk_target_ip!="",host_id!=""} * on (bk_target_ip) group_left () (count by (bk_target_ip) (bkmonitor:node_with_system_relation{bcs_cluster_id="cluster1",bk_target_ip!="",node!=""} * on (bcs_cluster_id, node) group_left () (count by (bcs_cluster_id, node) (bkmonitor:node_with_pod_relation{bcs_cluster_id="cluster1",namespace="ns1",node!="",pod="pod1"})))))) * on (host_id) group_left (version, env_name, env_type, service_version, service_type) bkmonitor:host_info_relation{host_id!=""}`,
118+
promQL: `(count by (bk_host_id) (bkmonitor:host_with_system_relation{bk_host_id!="",bk_target_ip!=""} * on (bk_target_ip) group_left () (count by (bk_target_ip) (bkmonitor:node_with_system_relation{bcs_cluster_id="cluster1",bk_target_ip!="",node!=""} * on (bcs_cluster_id, node) group_left () (count by (bcs_cluster_id, node) (bkmonitor:node_with_pod_relation{bcs_cluster_id="cluster1",namespace="ns1",node!="",pod="pod1"})))))) * on (bk_host_id) group_left (version, env_name, env_type, service_version, service_type) bkmonitor:host_info_relation{bk_host_id!=""}`,
119119
},
120120
{
121121
name: "level 2 and 1m with expand info and expand show",

pkg/unify-query/cmdb/v1beta1/v1beta1_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ func TestModel_GetResourceMatcherRange(t *testing.T) {
572572

573573
mock.Vm.Set(map[string]any{
574574
// host info
575-
"query_range:1693973987169397440760count by (host_id, version, env_name, env_type, service_version, service_type) (count_over_time(a[1m]))": victoriaMetrics.Data{
575+
"query_range:1693973987169397440760count by (bk_host_id, version, env_name, env_type, service_version, service_type) (count_over_time(a[1m]))": victoriaMetrics.Data{
576576
ResultType: victoriaMetrics.MatrixType,
577577
Result: []victoriaMetrics.Series{
578578
{
@@ -631,13 +631,13 @@ func TestModel_GetResourceMatcherRange(t *testing.T) {
631631
"host info": {
632632
source: "host",
633633
indexMatcher: cmdb.Matcher{
634-
"host_id": "12345",
634+
"bk_host_id": "12345",
635635
},
636636
targetInfoShow: true,
637637
expectedPath: []string{"host"},
638638
expectedSource: "host",
639639
expectedSourceInfo: map[string]string{
640-
"host_id": "12345",
640+
"bk_host_id": "12345",
641641
},
642642
expectedTarget: "host",
643643
expectedTargetList: []cmdb.MatchersWithTimestamp{

0 commit comments

Comments
 (0)