Skip to content

Create k8s-log-reviewer.md for logging review process#9037

Open
CatherineF-dev wants to merge 1 commit into
kubernetes:mainfrom
CatherineF-dev:log-reviewer-2
Open

Create k8s-log-reviewer.md for logging review process#9037
CatherineF-dev wants to merge 1 commit into
kubernetes:mainfrom
CatherineF-dev:log-reviewer-2

Conversation

@CatherineF-dev

Copy link
Copy Markdown
Contributor

Add guidelines for SIG-Instrumentation logging review process, including structured and contextual logging standards, review checklist, and testing practices.

Which issue(s) this PR fixes:

Fixes #9036

Add guidelines for SIG-Instrumentation logging review process, including structured and contextual logging standards, review checklist, and testing practices.
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: CatherineF-dev
Once this PR has been reviewed and has the lgtm label, please assign dashpole for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/developer-guide Issues or PRs related to the developer guide sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 19, 2026

@pohly pohly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems more targeted towards AI than humans? Just wondering.

Is it possible to do some sanity checking that this is actually producing useful reviews?

`logcheck.conf` (see #133699, #124722, #115669).

### 2. Contextual logging: thread a logger, don't proliferate `WithLogger` variants or break API.
- Prefer adding a `logger`/`ctx` parameter to a *new/unreleased* function rather than a parallel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's typically not possible when converting existing code. Sometimes a new method might be coming anyway, but usually not.

Comment on lines +33 to +34
left-over logger field). A function that logs gets the convention comment
`// Contextual logging: use NewXWithLogger`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
left-over logger field). A function that logs gets the convention comment
`// Contextual logging: use NewXWithLogger`.
left-over logger field). A function that logs initially gets the convention comment
`// Contextual logging: use NewXWithLogger`, then it's callers get updated in a follow-up, PR,
and then finally that comment is turned into `//logcheck:context // use NewXWithLogger ... instead` (https://github.com/kubernetes/kubernetes/issues/126379)

### 8. Testing log output: use `ktesting`, isolated per-test, not the global klog logger.
- **@pohly** (#138258): ktesting-based tests are *"perfectly isolated from any other test because only
local variables are used. This is different from testing output emitted through the global klog
logger."* Prefer `k8s.io/klog/v2/ktesting` / `test/utils/ktesting`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger."* Prefer `k8s.io/klog/v2/ktesting` / `test/utils/ktesting`.
logger."* Prefer `k8s.io/kubernetes/test/utils/ktesting` over `k8s.io/klog/v2/ktesting` whever import restrictions allow it.

local variables are used. This is different from testing output emitted through the global klog
logger."* Prefer `k8s.io/klog/v2/ktesting` / `test/utils/ktesting`.

### 9. Prefer returning an error over logging a swallowed warning.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
### 9. Prefer returning an error over logging a swallowed warning.
### 9. Prefer returning an error over logging and swallowed warning.

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

Labels

area/developer-guide Issues or PRs related to the developer guide cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sig-instrumentation]: standardize telemetry reviews

3 participants