Skip to content

[+] rewrite ParseLogs() with timers and eliminate extra checks#770

Merged
pashagolub merged 1 commit intomasterfrom
refactor-ParseLogs
May 30, 2025
Merged

[+] rewrite ParseLogs() with timers and eliminate extra checks#770
pashagolub merged 1 commit intomasterfrom
refactor-ParseLogs

Conversation

@pashagolub
Copy link
Copy Markdown
Collaborator

Use time.After() instead of blocking time.Sleep(). Move preparation to the beginning of the function and do it only once. If configuration changes, reaper will destroy the current context and start another one with new configuration. No need to recalculate csvlogRegex and logsGlobPath. Add deferred latest handle closing. Add non-blocking send to sinks channel. Add unit tests.

Use `time.After()` instead of blocking `time.Sleep()`. Move preparation
to the beginning of the function and do it only once. If configuration
changes, reaper will destroy the current context and start another
one with new configuration. No need to recalculate `csvlogRegex` and
`logsGlobPath`. Add deferred latest handle closing. Add non-blocking
send to sinks channel. Add unit tests.
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 15347540095

Details

  • 31 of 48 (64.58%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+4.3%) to 59.263%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/metrics/logparse.go 31 48 64.58%
Files with Coverage Reduction New Missed Lines %
internal/metrics/logparse.go 1 70.61%
Totals Coverage Status
Change from base Build 15342961868: 4.3%
Covered Lines: 2604
Relevant Lines: 4394

💛 - Coveralls

@pashagolub pashagolub self-assigned this May 30, 2025
@pashagolub pashagolub added metrics Metrics related issues refactoring Something done as it should've been done from the start labels May 30, 2025
@pashagolub pashagolub merged commit fb33d09 into master May 30, 2025
9 checks passed
@pashagolub pashagolub deleted the refactor-ParseLogs branch May 30, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metrics Metrics related issues refactoring Something done as it should've been done from the start

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants