stackdriver: always use regex full match for =~ and !=~operator

This commit is contained in:
Erik Sundell 2018-10-08 11:12:26 +02:00
parent 7e6a5c0a74
commit 8d53799bcd

View File

@ -199,7 +199,11 @@ func buildFilterString(metricType string, filterParts []interface{}) string {
if part == "AND" {
filterString += " "
} else if mod == 2 {
if strings.Contains(part.(string), "*") {
operator := filterParts[i-1]
if operator == "=~" || operator == "!=~" {
filterString = reverse(strings.Replace(reverse(filterString), "~", "", 1))
filterString += fmt.Sprintf(`monitoring.regex.full_match("%s")`, part)
} else if strings.Contains(part.(string), "*") {
filterString += interpolateFilterWildcards(part.(string))
} else {
filterString += fmt.Sprintf(`"%s"`, part)