Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update migration-to-structured-logging.md #6719

Merged
merged 1 commit into from Jun 30, 2022

Conversation

yangjunmyfm192085
Copy link
Contributor

Which issue(s) this PR fixes:

Fixes part of #110737

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. area/developer-guide Issues or PRs related to the developer guide sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. labels Jun 23, 2022
@yangjunmyfm192085
Copy link
Contributor Author

/cc @pohly @harshanarayana

@@ -407,6 +416,7 @@ Here are a few exceptions to the rules above---some cases are temporary workarou
then we should fallback to using object kind with suffix based on value type. For example `podName`, `podUID`.
* When providing multiple indistinguishable values (for example list of evicted pods), then we can use plural version of
argument name. For example we should use `pods` and not `podList`.
* we can use `Klog.KObjSlice` for Kubernetes objects.

Choose a reason for hiding this comment

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

IMHO, this is required here. This section talks about Here are a few exceptions to the rules above.

@@ -467,16 +477,17 @@ func ChangePodStatus(newStatus, currentStatus string) {
## Good practice for passing values in structured logging

When passing a value for a key-value pair, please use following rules:
* Prefer using Kubernetes objects (for example `*v1.Pod`) and log them using `klog.KObj`
* Prefer using Kubernetes objects (for example `*v1.Pod`) and log them using `klog.KObj` or `klog.KObjSlice`

Choose a reason for hiding this comment

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

KObjSlice is better off with resources having more than one entries. Using that for *v1.Pod for example is probably not a good idea right ?

* When the original object is not available, use `klog.KRef` instead
* When object sets, we use `klog.KObjSlice`

Choose a reason for hiding this comment

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

I think this line needs a bit more clarification. Did you mean When the object is slice type ?

Copy link
Contributor Author

@yangjunmyfm192085 yangjunmyfm192085 left a comment

Choose a reason for hiding this comment

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

@harshanarayana , Thanks for the very detailed review, I have applied all the suggestions, Could you please take a look again?

Copy link
Contributor Author

@yangjunmyfm192085 yangjunmyfm192085 left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@pohly pohly left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 30, 2022
@serathius
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pohly, serathius, yangjunmyfm192085

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

The pull request process is described here

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 Jun 30, 2022
@k8s-ci-robot k8s-ci-robot merged commit a7cb5e7 into kubernetes:master Jun 30, 2022
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. area/developer-guide Issues or PRs related to the developer guide 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. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. 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.

None yet

5 participants