Skip to content

Commit fe1dc40

Browse files
Fix nil error in warn logs about incompatible matchers
This commit fixes a small bug in the warning logs for incompatible matchers where the error from the UTF-8 parser was logged as nil. Signed-off-by: George Robinson <[email protected]>
1 parent 1da134a commit fe1dc40

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

matchers/compat/parse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func FallbackMatcherParser(l log.Logger, m *Metrics) ParseMatcher {
170170
// parser. This means the input is not forwards compatible.
171171
m.IncompatibleTotal.With(lbs).Inc()
172172
suggestion := cMatcher.String()
173-
level.Warn(l).Log("msg", "Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the old matchers parser as a fallback. To make this input compatible with the new parser please make sure all regular expressions and values are double-quoted. If you are still seeing this message please open an issue.", "input", input, "origin", origin, "err", err, "suggestion", suggestion)
173+
level.Warn(l).Log("msg", "Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the old matchers parser as a fallback. To make this input compatible with the new parser please make sure all regular expressions and values are double-quoted. If you are still seeing this message please open an issue.", "input", input, "origin", origin, "err", nErr, "suggestion", suggestion)
174174
return cMatcher, nil
175175
}
176176
// If the input is valid in both parsers, but produces different results,
@@ -219,7 +219,7 @@ func FallbackMatchersParser(l log.Logger, m *Metrics) ParseMatchers {
219219
suggestion := sb.String()
220220
// The input is valid in the pkg/labels parser, but not the
221221
// new matchers/parse parser.
222-
level.Warn(l).Log("msg", "Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the old matchers parser as a fallback. To make this input compatible with the new parser please make sure all regular expressions and values are double-quoted. If you are still seeing this message please open an issue.", "input", input, "origin", origin, "err", err, "suggestion", suggestion)
222+
level.Warn(l).Log("msg", "Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the old matchers parser as a fallback. To make this input compatible with the new parser please make sure all regular expressions and values are double-quoted. If you are still seeing this message please open an issue.", "input", input, "origin", origin, "err", nErr, "suggestion", suggestion)
223223
return cMatchers, nil
224224
}
225225
// If the input is valid in both parsers, but produces different results,

0 commit comments

Comments
 (0)