Skip to content

🌱 Switch to StartLogging for event debug logs#3451

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
timuthy:fix/event-debug-log
Feb 12, 2026
Merged

🌱 Switch to StartLogging for event debug logs#3451
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
timuthy:fix/event-debug-log

Conversation

@timuthy

@timuthy timuthy commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Switches from an event watcher to StartLogging to log events, as proposed by #3407.

Fixes #3407

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @timuthy. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 11, 2026
Comment thread pkg/internal/recorder/recorder.go Outdated
e, isEvt := event.(*eventsv1.Event)
if isEvt {
p.logger.V(1).Info(e.Note, "type", e.Type, "object", e.Related, "action", e.Action, "reason", e.Reason)
p.logger.V(1).Info(e.Note, "type", e.Type, "object", e.Regarding, "action", e.Action, "reason", e.Reason)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should do what was suggested in this issue #3407 instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice, I wasn't aware of #3407 - thanks for the feedback.

OTOH, what do you think about merging this small change until a proper PR for #3407 is available? It shouldn't cause any harm.

@sbueringer sbueringer Feb 12, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While logs are not really a stable API I would like to avoid changing the log format twice for folks that rely on the format.

I think we can simply implement half of #3407 here without much effort:

		stopWatcher, err := p.broadcaster.StartLogging(p.logger)
		if err != nil {
			p.logger.Error(err, "error starting event watcher for broadcaster")
		}

		p.stopWatcherFunc = stopWatcher

(Let's also rename stopWatcher and p.stopWatcherFunc to stopLogging and p.stopLoggingFunc)

@sbueringer

Copy link
Copy Markdown
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 12, 2026
@timuthy timuthy force-pushed the fix/event-debug-log branch from f4f33fa to 0434c92 Compare February 12, 2026 10:08
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 12, 2026
@timuthy timuthy changed the title 🌱 Use Regarding for event recorder debug log 🌱 Switch to StartLogging for event debug logs Feb 12, 2026
@timuthy timuthy changed the title 🌱 Switch to StartLogging for event debug logs 🌱 Switch to StartLogging for event debug logs Feb 12, 2026
@timuthy timuthy force-pushed the fix/event-debug-log branch from 0434c92 to 4ab2ca8 Compare February 12, 2026 10:45
@sbueringer

Copy link
Copy Markdown
Member

Thank you!

/lgtm

/assign @alvaroaleman

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 12, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 54479dd52e65455a38a69e30a55111f2cc27b72e

@alvaroaleman alvaroaleman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you!

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, timuthy

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 12, 2026
@k8s-ci-robot k8s-ci-robot merged commit 6d6daa8 into kubernetes-sigs:main Feb 12, 2026
14 checks passed
@timuthy timuthy deleted the fix/event-debug-log branch February 12, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use contextual logging for events

4 participants