mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-21 03:16:00 -08:00
Avoid API break
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
This commit is contained in:
parent
f7f80a3abf
commit
2d879c65fc
|
@ -111,6 +111,13 @@ func (m *Matcher) Inverse() (*Matcher, error) {
|
||||||
panic("labels.Matcher.Matches: invalid match type")
|
panic("labels.Matcher.Matches: invalid match type")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Matcher) GetRegexString() string {
|
||||||
|
if m.re == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return m.re.GetRegexString()
|
||||||
|
}
|
||||||
|
|
||||||
// SetMatches returns a set of equality matchers for the current regex matchers if possible.
|
// SetMatches returns a set of equality matchers for the current regex matchers if possible.
|
||||||
// For examples the regexp `a(b|f)` will returns "ab" and "af".
|
// For examples the regexp `a(b|f)` will returns "ab" and "af".
|
||||||
// Returns nil if we can't replace the regexp by only equality matchers.
|
// Returns nil if we can't replace the regexp by only equality matchers.
|
||||||
|
|
|
@ -61,6 +61,7 @@ func findSetMatches(re *syntax.Regexp, base string) []string {
|
||||||
if isCaseInsensitive(re) {
|
if isCaseInsensitive(re) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
clearBeginEndText(re)
|
||||||
switch re.Op {
|
switch re.Op {
|
||||||
case syntax.OpLiteral:
|
case syntax.OpLiteral:
|
||||||
return []string{base + string(re.Rune)}
|
return []string{base + string(re.Rune)}
|
||||||
|
@ -108,7 +109,6 @@ func findSetMatchesFromConcat(re *syntax.Regexp, base string) []string {
|
||||||
if len(re.Sub) == 0 {
|
if len(re.Sub) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
clearBeginEndText(re)
|
|
||||||
clearCapture(re.Sub...)
|
clearCapture(re.Sub...)
|
||||||
matches := []string{base}
|
matches := []string{base}
|
||||||
|
|
||||||
|
@ -209,6 +209,10 @@ func (m *FastRegexMatcher) SetMatches() []string {
|
||||||
return m.setMatches
|
return m.setMatches
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *FastRegexMatcher) GetRegexString() string {
|
||||||
|
return m.re.String()
|
||||||
|
}
|
||||||
|
|
||||||
// optimizeConcatRegex returns literal prefix/suffix text that can be safely
|
// optimizeConcatRegex returns literal prefix/suffix text that can be safely
|
||||||
// checked against the label value before running the regexp matcher.
|
// checked against the label value before running the regexp matcher.
|
||||||
func optimizeConcatRegex(r *syntax.Regexp) (prefix, suffix, contains string) {
|
func optimizeConcatRegex(r *syntax.Regexp) (prefix, suffix, contains string) {
|
||||||
|
|
Loading…
Reference in a new issue