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

Fix: report.utils: Fix the performance issue (bsc#1232821) #1606

Merged

Conversation

liangxin1300
Copy link
Collaborator

port from #1605

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.25%. Comparing base (3da03cd) to head (e6d58a0).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
crmsh/report/utils.py 93.33% 1 Missing ⚠️
Additional details and impacted files
Flag Coverage Δ
integration 54.50% <52.94%> (-0.01%) ⬇️
unit 52.14% <94.11%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
crmsh/report/collect.py 97.13% <100.00%> (ø)
crmsh/report/constants.py 100.00% <100.00%> (ø)
crmsh/report/utils.py 99.11% <93.33%> (+0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@liangxin1300 liangxin1300 marked this pull request as ready for review November 7, 2024 07:11
The function `extract_critical_log` can be very slow when processing
large log files. The main issue is the inefficiency of the regular
expression, which combines multiple wildcards (.*) with alternation (|),
leading to excessive backtracking. Additionally, the function reads the
entire file into memory, which is not optimal for large files.

To improve performance, it is better to use `grep` with the -F option to
search for fixed strings.
…dify time

No need to check the rest of the files if the from time is greater than
the modify time of the file.
@liangxin1300 liangxin1300 force-pushed the 20241105_bsc_1232821_master branch from e6d58a0 to b2dcf61 Compare November 7, 2024 13:06
@liangxin1300 liangxin1300 merged commit a052c25 into ClusterLabs:master Nov 8, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants