summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 525d2f2)
raw | patch | inline | side by side (parent: 525d2f2)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 25 Apr 2015 11:59:40 +0000 (13:59 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 25 Apr 2015 11:59:40 +0000 (13:59 +0200) |
server/query.go | patch | blob | history |
diff --git a/server/query.go b/server/query.go
index 6f9722c64a6c37130311bf3e15b9586039964764..cb74f22f479dcd4bbec5dcd787b82f0fdb992c5c 100644 (file)
--- a/server/query.go
+++ b/server/query.go
}
if fields := strings.SplitN(tok, ":", 2); len(fields) == 2 {
+ // Query: [<type>:] [<sibling-type>.]<attribute>:<value> ...
if i == 0 && fields[1] == "" {
typ = fields[0]
+ } else if elems := strings.Split(fields[0], "."); len(elems) > 1 {
+ objs := elems[:len(elems)-1]
+ for _, o := range objs {
+ if o != "host" && o != "service" && o != "metric" {
+ return nil, fmt.Errorf("Invalid object type %q", o)
+ }
+ }
+ args += fmt.Sprintf(" %s.attribute[%s] = %s",
+ strings.Join(objs, "."), proto.EscapeString(elems[len(elems)-1]),
+ proto.EscapeString(fields[1]))
} else {
args += fmt.Sprintf(" attribute[%s] = %s",
proto.EscapeString(fields[0]), proto.EscapeString(fields[1]))