mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-12 06:17:27 -08: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 true
|
||||||
}
|
}
|
||||||
return false
|
return len(m.Name) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matches returns whether the matcher matches the given string value.
|
// Matches returns whether the matcher matches the given string value.
|
||||||
|
|
|
@ -148,6 +148,13 @@ func TestExprString(t *testing.T) {
|
||||||
in: `{"_0"="1"}`,
|
in: `{"_0"="1"}`,
|
||||||
out: `{_0="1"}`,
|
out: `{_0="1"}`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
in: `{""="0"}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: "{``=\"0\"}",
|
||||||
|
out: `{""="0"}`,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range inputs {
|
for _, test := range inputs {
|
||||||
|
|
Loading…
Reference in a new issue