From 69030d964caed2de55d25114a42218b18ae0cd30 Mon Sep 17 00:00:00 2001 From: Roman Karpenko Date: Fri, 20 Dec 2024 16:19:58 +0200 Subject: [PATCH] improve regexp performance in `loki.process`: call fmt only if debug is enabled. fix debug check --- internal/component/loki/process/stages/regex.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/component/loki/process/stages/regex.go b/internal/component/loki/process/stages/regex.go index 27c7daf38..29fe56125 100644 --- a/internal/component/loki/process/stages/regex.go +++ b/internal/component/loki/process/stages/regex.go @@ -112,7 +112,7 @@ func (r *regexStage) Process(labels model.LabelSet, extracted map[string]interfa extracted[name] = match[i] } } - if level.Debug(r.logger).Enabled() { + if level.DebugValue() { level.Debug(r.logger).Log("msg", "extracted data debug in regex stage", "extracted data", fmt.Sprintf("%v", extracted)) } }