Skip to content

Demote replay-fix debug logs to trace level#698

Open
edcdavid wants to merge 1 commit into
redhat-cne:mainfrom
edcdavid:replay-fix-log-level
Open

Demote replay-fix debug logs to trace level#698
edcdavid wants to merge 1 commit into
redhat-cne:mainfrom
edcdavid:replay-fix-log-level

Conversation

@edcdavid

@edcdavid edcdavid commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

The observability logs introduced by the LIVE_START/replay-fix (PR #683)
use log.Debug, which fires at the default LOG_LEVEL=debug configured in
InitLogger(). This creates excessive log noise in normal operation.

Demote all new replay-fix debug logs from Debug to Trace so they remain
silent at the default debug level but are still available for deep
troubleshooting with LOG_LEVEL=trace.

Pre-existing logs that were inadvertently downgraded during the refactoring
are restored to their original levels (Info/Error).

The observability logs introduced by the LIVE_START/replay-fix (PR redhat-cne#683)
use log.Debug, which fires at the default LOG_LEVEL=debug configured in
InitLogger(). This creates excessive log noise in normal operation.

Demote all new replay-fix debug logs from Debug to Trace so they remain
silent at the default debug level but are still available for deep
troubleshooting with LOG_LEVEL=trace.

Logs that existed before the replay-fix and were inadvertently downgraded
are restored to their original levels (Info/Error).
@openshift-ci openshift-ci Bot requested review from aneeshkp and vitus133 June 9, 2026 14:18
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Chores
    • Adjusted logging verbosity levels to reduce debug output noise while enhancing error visibility and trace-level diagnostics across metrics components.

Walkthrough

This PR reduces logging verbosity across the PTP operator codebase by downgrading debug-level logs to trace level in metrics extraction and event generation paths, and in plugin connection message processing. A null check is added to guard the eventManager invocation.

Changes

Logging Verbosity Reduction

Layer / File(s) Summary
Metrics extraction logging downgrade
plugins/ptp_operator/metrics/manager.go, plugins/ptp_operator/metrics/metrics.go, plugins/ptp_operator/metrics/registry.go
GenPTPEvent, ExtractMetrics, TriggerLogs, and UpdateSyncStateMetrics downgrade event-generation, metric-detection, offset-parsing, and state-update debug logs to trace level.
Plugin connection processing and logging adjustment
plugins/ptp_operator/ptp_operator_plugin.go
processMessages adjusts connection acceptance and marker handling logging from debug to trace/info, adds a null guard before TriggerLogs invocation, and escalates scanner-failure logging to error level.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: demoting debug logs related to replay-fix functionality to trace level.
Description check ✅ Passed The description is well-related to the changeset, explaining the rationale for downgrading log levels and addressing excessive log noise in normal operation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/ptp_operator/ptp_operator_plugin.go`:
- Around line 546-547: In processMessages (the loop using scanner.Scan()), avoid
unconditionally logging an error when scanner.Scan() returns false; instead
check scanner.Err() and call log.Errorf (or similar) only if scanner.Err() !=
nil, and use a debug/trace/info-level log for a normal/clean connection close
when scanner.Err() == nil so that EOF/normal closure doesn't produce error
noise.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 6d880f80-477a-4697-913b-97dc407ba0fb

📥 Commits

Reviewing files that changed from the base of the PR and between ef79857 and 19a7e53.

📒 Files selected for processing (4)
  • plugins/ptp_operator/metrics/manager.go
  • plugins/ptp_operator/metrics/metrics.go
  • plugins/ptp_operator/metrics/registry.go
  • plugins/ptp_operator/ptp_operator_plugin.go

Comment on lines +546 to 547
log.Errorf("processMessages: scanner returned false (conn closed or error), breaking")
break

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid unconditional error logging on normal connection close.

At Line 546, scanner.Scan()==false is logged as Errorf unconditionally, but this also happens on clean EOF. This will produce false error noise and can trigger noisy alerts. Log error only when scanner.Err()!=nil; use trace/debug for normal close.

Proposed fix
 	ok := scanner.Scan()
 	if !ok {
-		log.Errorf("processMessages: scanner returned false (conn closed or error), breaking")
+		if err := scanner.Err(); err != nil {
+			log.Errorf("processMessages: scanner error: %v", err)
+		} else {
+			log.Trace("processMessages: connection closed by peer")
+		}
 		break
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
log.Errorf("processMessages: scanner returned false (conn closed or error), breaking")
break
ok := scanner.Scan()
if !ok {
if err := scanner.Err(); err != nil {
log.Errorf("processMessages: scanner error: %v", err)
} else {
log.Trace("processMessages: connection closed by peer")
}
break
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ptp_operator/ptp_operator_plugin.go` around lines 546 - 547, In
processMessages (the loop using scanner.Scan()), avoid unconditionally logging
an error when scanner.Scan() returns false; instead check scanner.Err() and call
log.Errorf (or similar) only if scanner.Err() != nil, and use a
debug/trace/info-level log for a normal/clean connection close when
scanner.Err() == nil so that EOF/normal closure doesn't produce error noise.

@nocturnalastro

Copy link
Copy Markdown
Contributor

/lgtm

@nocturnalastro

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edcdavid, nocturnalastro

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved label Jun 9, 2026
@nocturnalastro

Copy link
Copy Markdown
Contributor

/verified bypass

@openshift-ci-robot

Copy link
Copy Markdown

@nocturnalastro: The verified label has been added.

Details

In response to this:

/verified bypass

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@edcdavid: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws 19a7e53 link unknown /test e2e-aws
ci/prow/verify-deps 19a7e53 link unknown /test verify-deps
ci/prow/images 19a7e53 link unknown /test images

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-ci

openshift-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

1 similar comment
@openshift-ci

openshift-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants