optimize func of measurement data injection
This commit is contained in:
parent
666e1a9289
commit
a21a423624
|
|
@ -49,8 +49,7 @@ var configMetrics = []any{
|
||||||
"stable", "bay", "craft", "integrity", "behavior",
|
"stable", "bay", "craft", "integrity", "behavior",
|
||||||
}
|
}
|
||||||
|
|
||||||
// BulkInsertAllHierarchySets 是主入口函数,用于协调所有 Set 插入操作。
|
func bulkInsertAllHierarchySets(ctx context.Context, rdb *redis.Client) error {
|
||||||
func BulkInsertAllHierarchySets(ctx context.Context, rdb *redis.Client) error {
|
|
||||||
log.Println("starting bulk insertion of Redis hierarchy sets")
|
log.Println("starting bulk insertion of Redis hierarchy sets")
|
||||||
|
|
||||||
if err := insertStaticSets(ctx, rdb); err != nil {
|
if err := insertStaticSets(ctx, rdb); err != nil {
|
||||||
|
|
@ -205,8 +204,7 @@ func insertDynamicHierarchy(ctx context.Context, rdb *redis.Client) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func insertAllHierarchySuggestions(ac *redisearch.Autocompleter) error {
|
func insertAllHierarchySuggestions(ac *redisearch.Autocompleter) error {
|
||||||
suggestions := make([]redisearch.Suggestion, 0, 10000) // 预估容量:~2430 (Metric) + ~1100 (Path Prefixes)
|
suggestions := make([]redisearch.Suggestion, 0, 10000)
|
||||||
|
|
||||||
// S: grid Index (1-3)
|
// S: grid Index (1-3)
|
||||||
for S := 1; S <= 3; S++ {
|
for S := 1; S <= 3; S++ {
|
||||||
gridStr := fmt.Sprintf("grid%d", S)
|
gridStr := fmt.Sprintf("grid%d", S)
|
||||||
|
|
@ -326,7 +324,7 @@ func main() {
|
||||||
log.Fatalf("error delete exist set before bulk insertion: %v", err)
|
log.Fatalf("error delete exist set before bulk insertion: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := BulkInsertAllHierarchySets(ctx, rdb); err != nil {
|
if err := bulkInsertAllHierarchySets(ctx, rdb); err != nil {
|
||||||
log.Fatalf("error during bulk insertion: %v", err)
|
log.Fatalf("error during bulk insertion: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue