这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion opentsdb/tsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@ func ParseFilters(rawFilters string, grouping bool, q *Query) ([]Filter, error)
}
filter := Filter{}
filter.TagK = splitRawFilter[0]
q.GroupByTags[filter.TagK] = ""
if grouping {
q.GroupByTags[filter.TagK] = ""
}
// See if we have a filter function, if not we have to use legacy parsing defined in
// filter conversions of http://opentsdb.net/docs/build/html/api_http/query/index.html
m := filterValueRe.FindStringSubmatch(splitRawFilter[1])
Expand Down
18 changes: 18 additions & 0 deletions opentsdb/tsdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ func TestParseRequestV2_2(t *testing.T) {
}
}
}
func TestTagGroupParsing(t *testing.T) {
tests := []struct {
query string
groups string
}{
{"sum:10m-avg:proc.stat.cpu{}{t=v,o=k}", "{}"},
{"sum:10m-avg:proc.stat.cpu{dc=uk}{t=v,o=k}", "{dc=}"},
}
for _, q := range tests {
r, err := ParseQuery(q.query, Version2_2)
if err == nil {
if r.GroupByTags.String() != q.groups {
t.Errorf("expected group tags %s got %s", q.groups, r.GroupByTags)
}

}
}
}

func TestParseFilters(t *testing.T) {
tests := []struct {
Expand Down