From 22983b251c2454e1252b9626bd1c2268631b2d77 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Wed, 29 Jan 2025 13:51:25 -0800 Subject: [PATCH] handle values contain + (#143) Signed-off-by: yeya24 --- walk.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/walk.go b/walk.go index 06d5506..f2ddcfe 100644 --- a/walk.go +++ b/walk.go @@ -462,6 +462,11 @@ func (s *PromQLSmith) walkLabelMatchers() []*labels.Matcher { }) valF := func(v string) string { + // If a label value contains + such as +Inf it will cause parse error for regex. + // Always hardcode to .+ for simplicity. + if strings.Contains(v, "+") { + return ".+" + } val := s.rnd.Float64() switch { case val > 0.95: