mirror of
https://github.com/prometheus/prometheus
synced 2024-12-25 16:02:28 +00:00
Merge pull request #14296 from colega/fix-matcher-string-with-empty-label-name
Fix `Matcher.String()` with empty label name
This commit is contained in:
commit
5c417684f8
@ -101,7 +101,7 @@ func (m *Matcher) shouldQuoteName() bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return len(m.Name) == 0
|
||||
}
|
||||
|
||||
// Matches returns whether the matcher matches the given string value.
|
||||
|
@ -148,6 +148,13 @@ func TestExprString(t *testing.T) {
|
||||
in: `{"_0"="1"}`,
|
||||
out: `{_0="1"}`,
|
||||
},
|
||||
{
|
||||
in: `{""="0"}`,
|
||||
},
|
||||
{
|
||||
in: "{``=\"0\"}",
|
||||
out: `{""="0"}`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range inputs {
|
||||
|
Loading…
Reference in New Issue
Block a user