Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve regexp component performance in loki.process: call fmt only if debug enabled #2272

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ Main (unreleased)

- Use a forked `github.com/goccy/go-json` module which reduces the memory consumption of an Alloy instance by 20MB.
If Alloy is running certain otelcol components, this reduction will not apply. (@ptodev)
- improve performance in regexp component: call fmt only if debug is enabled (@r0ka)
- Update `prometheus.write.queue` library for performance increases in cpu. (@mattdurham)


### Bugfixes

- Fixed issue with reloading configuration and prometheus metrics duplication in `prometheus.write.queue`. (@mattdurham)
Expand Down
4 changes: 3 additions & 1 deletion internal/component/loki/process/stages/regex.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@
extracted[name] = match[i]
}
}
level.Debug(r.logger).Log("msg", "extracted data debug in regex stage", "extracted data", fmt.Sprintf("%v", extracted))
if level.Debug(r.logger).Enabled() {

Check failure on line 115 in internal/component/loki/process/stages/regex.go

View workflow job for this annotation

GitHub Actions / Test (macos-latest-xlarge)

level.Debug(r.logger).Enabled undefined (type "github.com/go-kit/log".Logger has no field or method Enabled)

Check failure on line 115 in internal/component/loki/process/stages/regex.go

View workflow job for this annotation

GitHub Actions / run_tests

level.Debug(r.logger).Enabled undefined (type "github.com/go-kit/log".Logger has no field or method Enabled)
level.Debug(r.logger).Log("msg", "extracted data debug in regex stage", "extracted data", fmt.Sprintf("%v", extracted))
}
}

// Name implements Stage
Expand Down
Loading