Skip to content

Commit

Permalink
Merge pull request #150 from msaf1980/tagged-multi-value-globs
Browse files Browse the repository at this point in the history
Fix for empty tag value during autocompletion
  • Loading branch information
Felixoid authored Apr 24, 2021
2 parents 035b56d + acc123d commit 2e8dbed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions finder/tagged_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ func TestTaggedWhere(t *testing.T) {
{"seriesByTag('name=value','what!={avg,max}')", "(Tag1='__name__=value') AND (NOT arrayExists((x) -> x IN ('what=avg','what=max'), Tags))", "", false},
// grafana workaround for multi-value variables default, masked with *
{"seriesByTag('name=value','what=~*')", "(Tag1='__name__=value') AND (arrayExists((x) -> x LIKE 'what=%', Tags))", "", false}, // If All masked to value with *
// empty tag value during autocompletion
{"seriesByTag('name=value','what=~')", "(Tag1='__name__=value') AND (arrayExists((x) -> x LIKE 'what=%', Tags))", "", false}, // If All masked to value with *
}

for _, test := range table {
Expand Down
2 changes: 1 addition & 1 deletion pkg/where/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func ConcatMatchKV(key, value string) string {
}

func Match(field string, key, value string) string {
if value == "*" {
if len(value) == 0 || value == "*" {
return Like(field, key+"=%")
}
expr := ConcatMatchKV(key, value)
Expand Down

0 comments on commit 2e8dbed

Please sign in to comment.