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

chore: Log level detection improvements #12440

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

sandeepsukhani
Copy link
Contributor

What this PR does / why we need it:

  1. Add a benchmark for log-level detection code.
  2. Check for log levels in standard logging formats before doing a broader search. This change has sped up the code to detect log formats from the logline based on the benchmark:
benchmark                                   old ns/op     new ns/op     delta
Benchmark_extractLogLevelFromLogLine-10     3427          3013          -12.08%
Benchmark_extractLogLevelFromLogLine-10     3443          3008          -12.63%
Benchmark_extractLogLevelFromLogLine-10     3498          3007          -14.04%
Benchmark_extractLogLevelFromLogLine-10     3496          3010          -13.90%
Benchmark_extractLogLevelFromLogLine-10     3504          3015          -13.96%

benchmark                                   old allocs     new allocs     delta
Benchmark_extractLogLevelFromLogLine-10     1              1              +0.00%
Benchmark_extractLogLevelFromLogLine-10     1              1              +0.00%
Benchmark_extractLogLevelFromLogLine-10     1              1              +0.00%
Benchmark_extractLogLevelFromLogLine-10     1              1              +0.00%
Benchmark_extractLogLevelFromLogLine-10     1              1              +0.00%

benchmark                                   old bytes     new bytes     delta
Benchmark_extractLogLevelFromLogLine-10     16            16            +0.00%
Benchmark_extractLogLevelFromLogLine-10     16            16            +0.00%
Benchmark_extractLogLevelFromLogLine-10     16            16            +0.00%
Benchmark_extractLogLevelFromLogLine-10     16            16            +0.00%
Benchmark_extractLogLevelFromLogLine-10     16            16            +0.00%

Checklist

  • Tests updated

@sandeepsukhani sandeepsukhani requested a review from a team as a code owner April 3, 2024 04:33
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@sandeepsukhani sandeepsukhani merged commit 1ae5b3e into main Apr 3, 2024
12 checks passed
@sandeepsukhani sandeepsukhani deleted the log-level-detection-improvements branch April 3, 2024 05:14
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants