From 337d6a1a7cb17c2207df0753fdd1c74c5b428351 Mon Sep 17 00:00:00 2001 From: droy Date: Thu, 26 Mar 2026 19:33:55 +0100 Subject: [PATCH 1/5] add debug --- gnmicollect/node.go | 11 ++++++++--- gnmicollect/parser.go | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gnmicollect/node.go b/gnmicollect/node.go index c7d6642..4f565d6 100644 --- a/gnmicollect/node.go +++ b/gnmicollect/node.go @@ -1,6 +1,9 @@ package gnmicollect -import "strings" +import ( + "jtso/logger" + "strings" +) type TrieNode struct { children map[string]*TrieNode @@ -124,8 +127,7 @@ func (n *TreeNode) Traverse(f func(node *TreeNode)) { } } -/// For gnmi once only - to auto detect aliasing - +// / For gnmi once only - to auto detect aliasing func Insert(root *TrieNode, base string, xpath string) { // Normalize xpath starting with "./" -> concatenate with the base path @@ -137,6 +139,8 @@ func Insert(root *TrieNode, base string, xpath string) { parts := strings.Split(strings.Trim(xpath, "/"), "/") node := root + logger.Log.Infof("DEBUG: parts = %v for xpath %s", parts, xpath) + for _, p := range parts { if node.children == nil { node.children = make(map[string]*TrieNode) @@ -147,6 +151,7 @@ func Insert(root *TrieNode, base string, xpath string) { node = node.children[p] node.count++ } + logger.Log.Infof("DEBUG: node is now %v for xpath %s", node, xpath) } func CollectPrefixes(node *TrieNode, path []string, result *[]string) { diff --git a/gnmicollect/parser.go b/gnmicollect/parser.go index b88a726..acb1d89 100644 --- a/gnmicollect/parser.go +++ b/gnmicollect/parser.go @@ -757,6 +757,7 @@ Loop: rootAlias := &TrieNode{} for _, k := range fieldKeys { + logger.Log.Infof("DEBUG: Field extracted: %s with tags %v", k, fieldMap[k]) f := Field{ Name: k, Monitor: false, @@ -768,6 +769,7 @@ Loop: // to detect alias then Insert(rootAlias, o.Path, k) + logger.Log.Infof("DEBUG: Inserted in Trie with base %s and xpath %s", o.Path, k) } // Provision Alias if found out. From 24e6e82a3c7d4afda2fcaa93913081bbf2a4dc48 Mon Sep 17 00:00:00 2001 From: droy Date: Thu, 26 Mar 2026 19:44:08 +0100 Subject: [PATCH 2/5] ManageDebug --- gnmicollect/node.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gnmicollect/node.go b/gnmicollect/node.go index 4f565d6..671a719 100644 --- a/gnmicollect/node.go +++ b/gnmicollect/node.go @@ -142,14 +142,18 @@ func Insert(root *TrieNode, base string, xpath string) { logger.Log.Infof("DEBUG: parts = %v for xpath %s", parts, xpath) for _, p := range parts { + logger.Log.Infof("DEBUG: processing part %s for xpath %s", p, xpath) if node.children == nil { node.children = make(map[string]*TrieNode) + logger.Log.Infof("DEBUG: initialized children map for node %v for xpath %s", node, xpath) } if _, ok := node.children[p]; !ok { node.children[p] = &TrieNode{} + logger.Log.Infof("DEBUG: created new TrieNode for part %s for xpath %s", p, xpath) } node = node.children[p] node.count++ + logger.Log.Infof("DEBUG: node %v count incremented to %d for xpath %s", node, node.count, xpath) } logger.Log.Infof("DEBUG: node is now %v for xpath %s", node, xpath) } From 353753e522ecdc4ffb901c986ed7d207dddb1fcd Mon Sep 17 00:00:00 2001 From: droy Date: Thu, 26 Mar 2026 19:52:05 +0100 Subject: [PATCH 3/5] fix it --- gnmicollect/node.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gnmicollect/node.go b/gnmicollect/node.go index 671a719..82f1974 100644 --- a/gnmicollect/node.go +++ b/gnmicollect/node.go @@ -139,27 +139,26 @@ func Insert(root *TrieNode, base string, xpath string) { parts := strings.Split(strings.Trim(xpath, "/"), "/") node := root - logger.Log.Infof("DEBUG: parts = %v for xpath %s", parts, xpath) - for _, p := range parts { - logger.Log.Infof("DEBUG: processing part %s for xpath %s", p, xpath) + if node.children == nil { node.children = make(map[string]*TrieNode) - logger.Log.Infof("DEBUG: initialized children map for node %v for xpath %s", node, xpath) + } if _, ok := node.children[p]; !ok { node.children[p] = &TrieNode{} - logger.Log.Infof("DEBUG: created new TrieNode for part %s for xpath %s", p, xpath) + } node = node.children[p] node.count++ - logger.Log.Infof("DEBUG: node %v count incremented to %d for xpath %s", node, node.count, xpath) + } - logger.Log.Infof("DEBUG: node is now %v for xpath %s", node, xpath) } func CollectPrefixes(node *TrieNode, path []string, result *[]string) { + logger.Log.Infof("DEBUG: Collecting prefixes at node with count %d and path %v", node.count, path) for seg, child := range node.children { + logger.Log.Infof("DEBUG: Collecting prefix for segment %s with count %d", seg, child.count) if child.count >= 2 { // Copy path to avoid slice corruption from append reusing underlying array newPath := make([]string, len(path)+1) @@ -168,6 +167,7 @@ func CollectPrefixes(node *TrieNode, path []string, result *[]string) { stop := false for _, gc := range child.children { + logger.Log.Infof("DEBUG: Checking grandchild %v with count %d", gc, gc.count) if gc.count < 2 { stop = true break From 217eae9d6414a970f9cee4b2376306e188fcb415 Mon Sep 17 00:00:00 2001 From: droy Date: Thu, 26 Mar 2026 20:00:52 +0100 Subject: [PATCH 4/5] fix --- gnmicollect/node.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnmicollect/node.go b/gnmicollect/node.go index 82f1974..03f5c7b 100644 --- a/gnmicollect/node.go +++ b/gnmicollect/node.go @@ -159,7 +159,7 @@ func CollectPrefixes(node *TrieNode, path []string, result *[]string) { logger.Log.Infof("DEBUG: Collecting prefixes at node with count %d and path %v", node.count, path) for seg, child := range node.children { logger.Log.Infof("DEBUG: Collecting prefix for segment %s with count %d", seg, child.count) - if child.count >= 2 { + if child.count >= 1 { // Copy path to avoid slice corruption from append reusing underlying array newPath := make([]string, len(path)+1) copy(newPath, path) From 9be5b93a2bb927ee276bbc5efb1dd3f412670191 Mon Sep 17 00:00:00 2001 From: droy Date: Fri, 27 Mar 2026 17:56:20 +0100 Subject: [PATCH 5/5] v1.1.1 --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index e7bd700..63f06f4 100644 --- a/config/config.go +++ b/config/config.go @@ -10,7 +10,7 @@ import ( ) // this is config displayed on the main page -const JTSO_VERSION string = "1.1.0" +const JTSO_VERSION string = "1.1.1" type PortalConfig struct { Https bool