fix(observability): remove invalid fields match and match_regex from main route in alert_config (#915)
* fix: remove invalid `match` and `match_regex` from main route in alert_config - deprecated `match` and `match_regex` in child routes - add new `matchers` field
This commit is contained in:
parent
433efa001c
commit
65c6106ea9
9 changed files with 157 additions and 111 deletions
|
|
@ -556,7 +556,10 @@ func ConvertConfigVariable(variable config.Variable) string {
|
|||
tmpByteArray, _ := variable.MarshalJSON()
|
||||
// In case the variable is a string, the quotes should be removed
|
||||
if tmpByteArray[0] == '"' && tmpByteArray[len(tmpByteArray)-1] == '"' {
|
||||
return string(tmpByteArray[1 : len(tmpByteArray)-1])
|
||||
result := string(tmpByteArray[1 : len(tmpByteArray)-1])
|
||||
// Replace escaped quotes which where added MarshalJSON
|
||||
rawString := strings.ReplaceAll(result, `\"`, `"`)
|
||||
return rawString
|
||||
}
|
||||
return string(tmpByteArray)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@ func TestConvertConfigVariable(t *testing.T) {
|
|||
variable: config.IntegerVariable(10),
|
||||
want: "10",
|
||||
},
|
||||
{
|
||||
name: "quoted string",
|
||||
variable: config.StringVariable(`instance =~ ".*"`),
|
||||
want: `instance =~ ".*"`,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue