Skip to content

Conversation

@jortel
Copy link
Contributor

@jortel jortel commented Nov 20, 2025

Log the db based on Logger level enabled instead of using the Setting directly.

Log the reaper only when it takes a long time. Reduces spam in the logs.

Summary by CodeRabbit

Release Notes

  • Refactor
    • Refactored logging configuration to use verbose log levels instead of numeric settings thresholds.
    • Improved performance monitoring with selective duration logging for operations exceeding 10 seconds.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: Jeff Ortel <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Nov 20, 2025

Walkthrough

Log enablement checks are refactored from numeric thresholds to verbose logger method calls across two manager files. Additionally, the reaper manager introduces conditional duration logging based on a 10-second execution threshold.

Changes

Cohort / File(s) Summary
Log enablement refactoring
reaper/manager.go, task/manager.go
Changed database debugging gate from Settings.Log.Reaper > 0 and Settings.Log.Task > 0 to Log.V(1).Enabled() for both files
Threshold-based duration logging
reaper/manager.go
Added a 10-second threshold variable and conditional duration logging that only records execution time when it exceeds the threshold

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Straightforward refactoring following a consistent pattern across files
  • Logging configuration change with minimal behavioral impact
  • Limited scope and no exported signature changes
  • Threshold logic is straightforward and localized to the reaper manager

Poem

Verbose logs now guide the way,
Thresholds filter noise all day,
Ten-second marks the reaper's pace,
Cleaner logs, a neater place! 🐰✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly relates to the main changes in the PR, which involve adjusting logging behavior in both reaper/manager.go and task/manager.go by switching from settings-based checks to Logger level checks and adding threshold-based conditional logging.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
reaper/manager.go (1)

54-70: Consider structured logging for better observability.

The threshold-based conditional logging successfully reduces log spam as intended. However, the log message on line 69 uses string concatenation rather than structured key-value pairs.

Apply this diff to improve log message structure:

-				if d > threshold {
-					Log.Info("Duration: " + d.String())
-				}
+				if d > threshold {
+					Log.Info(
+						"Reaper duration exceeded threshold.",
+						"duration",
+						d.String(),
+						"threshold",
+						threshold.String())
+				}

This provides better structured logging and makes it easier to filter/query logs in observability tools.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dbd77d2 and f8278c5.

📒 Files selected for processing (2)
  • reaper/manager.go (3 hunks)
  • task/manager.go (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-28T22:13:58.822Z
Learnt from: jortel
Repo: konveyor/tackle2-hub PR: 897
File: task/collector.go:95-96
Timestamp: 2025-10-28T22:13:58.822Z
Learning: In the konveyor/tackle2-hub codebase, `Log.Error(err, "")` is a no-op when `err == nil`, so there's no need to add explicit `if err != nil` checks before calling `Log.Error`.

Applied to files:

  • task/manager.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build
  • GitHub Check: test-unit
  • GitHub Check: vet
🔇 Additional comments (2)
task/manager.go (1)

138-140: LGTM! Logging behavior improved.

The change from a numeric settings check to Log.V(1).Enabled() correctly gates DB debug logging based on the logger's verbosity level, which is more idiomatic and aligns with structured logging practices.

reaper/manager.go (1)

36-38: LGTM! Consistent logging pattern.

The change to Log.V(1).Enabled() matches the approach in task/manager.go and correctly uses the logger's verbosity level instead of a numeric settings check.

@jortel jortel merged commit 9081046 into konveyor:main Nov 25, 2025
16 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