Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit 3f6d830

Browse files
committed
comments and fixing case of untagged series
1 parent b26e38c commit 3f6d830

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

idx/memory/memory.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,15 @@ func (m *MemoryIdx) add(def *schema.MetricDefinition) idx.Archive {
303303
}
304304

305305
pos := strings.Index(path, ";")
306-
307-
// now walk backwards through the node path to find the first branch which exists that
308-
// this path extends.
309306
if pos == -1 {
310307
pos = strings.LastIndex(path, ".")
311308
} else {
309+
// find the last '.' that is not part of a tag
312310
pos = strings.LastIndex(path[:pos], ".")
313311
}
314312

313+
// now walk backwards through the node path to find the first branch which exists that
314+
// this path extends.
315315
prevPos := len(path)
316316
for pos != -1 {
317317
branch := path[:pos]
@@ -636,6 +636,8 @@ func (m *MemoryIdx) find(orgId int, pattern string) ([]*Node, error) {
636636
tags := nodes[1]
637637
nodes = strings.Split(nodes[0], ".")
638638
nodes[len(nodes)-1] += ";" + tags
639+
} else {
640+
nodes = strings.Split(nodes[0], ".")
639641
}
640642

641643
// pos is the index of the first node with special chars, or one past the last node if exact

0 commit comments

Comments
 (0)