Skip to content

Commit

Permalink
fix the issues when mulit-segments is here
Browse files Browse the repository at this point in the history
Signed-off-by: Gao Hongtao <hanahmily@gmail.com>
  • Loading branch information
hanahmily committed Nov 16, 2024
1 parent 3720cfb commit eb0189c
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/cases/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Initialize(addr string, now time.Time) {
casesstreamdata.Write(conn, "duplicated", now, 0)
// // measure
interval = time.Minute
casesmeasuredata.Write(conn, "service_traffic", "sw_metric", "service_traffic_data_expired.json", now.AddDate(0, 0, -1), interval)
casesmeasuredata.Write(conn, "service_traffic", "sw_metric", "service_traffic_data_old.json", now.AddDate(0, 0, -1), interval)
casesmeasuredata.Write(conn, "service_traffic", "sw_metric", "service_traffic_data.json", now, interval)
casesmeasuredata.Write(conn, "service_instance_traffic", "sw_metric", "service_instance_traffic_data.json", now, interval)
casesmeasuredata.Write(conn, "service_cpm_minute", "sw_metric", "service_cpm_minute_data.json", now, interval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,43 @@
]
}
]
},
{
"tag_families": [
{
"tags": [
{
"str": {
"value": "4"
}
},
{
"str": {
"value": "service_4"
}
},
{
"str": {
"value": "service_name_4"
}
},
{
"str": {
"value": "service_short_name_4"
}
},
{
"str": {
"value": "group4"
}
},
{
"int": {
"value": 3
}
}
]
}
]
}
]
137 changes: 137 additions & 0 deletions test/cases/measure/data/want/index_mode_all_segs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Licensed to Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Apache Software Foundation (ASF) licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
dataPoints:
- sid: "15142466043926325685"
tagFamilies:
- name: default
tags:
- key: id
value:
str:
value: "1"
- key: service_id
value:
str:
value: service_1
- key: name
value:
str:
value: service_name_1
- key: short_name
value:
str:
value: service_short_name_1
- key: service_group
value:
str:
value: group1
- key: layer
value:
int:
value: "1"
timestamp: "2024-11-16T11:17:00Z"
version: "1"
- sid: "3906119849472468294"
tagFamilies:
- name: default
tags:
- key: id
value:
str:
value: "2"
- key: service_id
value:
str:
value: service_2
- key: name
value:
str:
value: service_name_2
- key: short_name
value:
str:
value: service_short_name_2
- key: service_group
value:
str:
value: group1
- key: layer
value:
int:
value: "2"
timestamp: "2024-11-16T11:18:00Z"
version: "1"
- sid: "12370392692163567533"
tagFamilies:
- name: default
tags:
- key: id
value:
str:
value: "3"
- key: service_id
value:
str:
value: service_3
- key: name
value:
str:
value: service_name_3
- key: short_name
value:
str:
value: service_short_name_3
- key: service_group
value:
str:
value: group1
- key: layer
value:
int:
value: "1"
timestamp: "2024-11-16T11:19:00Z"
version: "1"
- sid: "16450204962168035869"
tagFamilies:
- name: default
tags:
- key: id
value:
str:
value: "4"
- key: service_id
value:
str:
value: service_4
- key: name
value:
str:
value: service_name_4
- key: short_name
value:
str:
value: service_short_name_4
- key: service_group
value:
str:
value: group4
- key: layer
value:
int:
value: "3"
timestamp: "2024-11-15T11:19:00Z"
version: "1"
2 changes: 1 addition & 1 deletion test/cases/measure/measure.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var _ = g.DescribeTable("Scanning Measures", verify,
g.Entry("duplicated in a part", helpers.Args{Input: "duplicated_part", Duration: 25 * time.Minute, Offset: -20 * time.Minute}),
g.Entry("match a tag belongs to the entity", helpers.Args{Input: "entity_match", Duration: 25 * time.Minute, Offset: -20 * time.Minute}),
g.Entry("all of index mode", helpers.Args{Input: "index_mode_all", Duration: 25 * time.Minute, Offset: -20 * time.Minute}),
g.FEntry("all in all segments of index mode", helpers.Args{Input: "index_mode_all", Duration: 36 * time.Minute, Offset: -48 * time.Hour}),
g.Entry("all in all segments of index mode", helpers.Args{Input: "index_mode_all", Want: "index_mode_all_segs", Duration: 72 * time.Hour, Offset: -48 * time.Hour}),
g.Entry("order by desc of index mode", helpers.Args{Input: "index_mode_order_desc", Duration: 25 * time.Minute, Offset: -20 * time.Minute}),
g.Entry("range of index mode", helpers.Args{Input: "index_mode_range", Duration: 25 * time.Minute, Offset: -20 * time.Minute}),
g.Entry("none of index mode", helpers.Args{Input: "index_mode_none", WantEmpty: true, Duration: 25 * time.Minute, Offset: -20 * time.Minute}),
Expand Down

0 comments on commit eb0189c

Please sign in to comment.