From fd759b647a9efe56c3ae62c082a0cf01cd9d5301 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Thu, 12 Sep 2024 10:27:06 +0530 Subject: [PATCH] fix: config items not being assigned parents --- db/update.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/update.go b/db/update.go index 596d5b5f..7243142b 100644 --- a/db/update.go +++ b/db/update.go @@ -1114,7 +1114,7 @@ func getPath(ctx api.ScrapeContext, parentMap map[string]string, self string) (s for parent := getOrFind(ctx, parentMap, self); parent != ""; parent = getOrFind(ctx, parentMap, parent) { if slices.Contains(paths, parent) { - return "", false + return strings.Join(paths, "."), true } paths = append([]string{parent}, paths...) } @@ -1144,7 +1144,7 @@ func setConfigPaths(ctx api.ScrapeContext, allConfigs []*models.ConfigItem) erro } for _, config := range allConfigs { - for i := 1; i < len(config.ProbableParents); i++ { + for i := 0; i < len(config.ProbableParents); i++ { // If no cylce is detected, we set path and parentID path, ok := getPath(ctx, parentMap, config.ID) if ok {