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

Structured Logging migration:modify Scheduler part logs. #99273

Merged
merged 1 commit into from Aug 30, 2021

Conversation

yangjunmyfm192085
Copy link
Contributor

@yangjunmyfm192085 yangjunmyfm192085 commented Feb 20, 2021

Signed-off-by: JunYang yang.jun22@zte.com.cn

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Structured Logging migration:modify Scheduler part logs.
xref:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1602-structured-logging
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

part of kubernetes/enhancements#1602
As it is related to log, change the log here to structured log.

Does this PR introduce a user-facing change?

Migrate `pkg/scheduler` to structured logging

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 20, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @yangjunmyfm192085. Thanks for your PR.

I'm waiting for a kubernetes 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.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 20, 2021
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 20, 2021
pkg/scheduler/framework/runtime/framework.go Outdated Show resolved Hide resolved
pkg/scheduler/framework/runtime/framework.go Outdated Show resolved Hide resolved
pkg/scheduler/framework/runtime/framework.go Outdated Show resolved Hide resolved
@gavinfish
Copy link
Contributor

/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 21, 2021
@yangjunmyfm192085
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind

Copy link
Member

@chendave chendave left a comment

Choose a reason for hiding this comment

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

I have seen many PR to address this simple issue, which are scattered here and there, is that better to make this fixed in one PR instead?

@yangjunmyfm192085
Copy link
Contributor Author

I have seen many PR to address this simple issue, which are scattered here and there, is that better to make this fixed in one PR instead?

Good question.
I think that all modifications are done in one pr may not be realistic because the amount of modification is too much.
Any better suggestions?
Modify by package?

@@ -164,7 +164,7 @@ func applyFeatureGates(config *schedulerapi.Plugins) {
if !utilfeature.DefaultFeatureGate.Enabled(features.DefaultPodTopologySpread) {
// When feature is enabled, the default spreading is done by
// PodTopologySpread plugin, which is enabled by default.
klog.Infof("Registering SelectorSpread plugin")
klog.InfoS("Registering SelectorSpread plugin")
Copy link
Member

Choose a reason for hiding this comment

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

Any difference here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah,new Structured Logging migration uses InfoS.

Copy link
Member

Choose a reason for hiding this comment

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

but for this case, I cannot see any benefit from the change, Infof is still there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes,for this case,may not see the difference.But when there are variables, the format is different.
According to the following rules, Infof will be replaced by InfoS.
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1602-structured-logging

pkg/scheduler/scheduler.go Show resolved Hide resolved
Copy link
Member

@adtac adtac left a comment

Choose a reason for hiding this comment

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

couple of nits

pkg/scheduler/framework/runtime/framework.go Outdated Show resolved Hide resolved
@@ -56,7 +56,7 @@ func GetPodStartTime(pod *v1.Pod) *metav1.Time {
func GetEarliestPodStartTime(victims *extenderv1.Victims) *metav1.Time {
if len(victims.Pods) == 0 {
// should not reach here.
klog.Errorf("victims.Pods is empty. Should not reach here.")
klog.ErrorS(nil, "Victims.Pods is empty. Should not reach here.")
Copy link
Member

Choose a reason for hiding this comment

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

does this need to be changed? it's referring to a variable name here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any better suggestion?
According to structured Logging migration,Errorf needs to be converted to ErrorS.

Copy link
Member

Choose a reason for hiding this comment

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

nvm, I'm fine with this

@yangjunmyfm192085
Copy link
Contributor Author

yangjunmyfm192085 commented May 28, 2021

/test pull-kubernetes-node-e2e-containerd
/wg structured-logging
/triage accepted

@yangjunmyfm192085
Copy link
Contributor Author

/test pull-kubernetes-unit

@yangjunmyfm192085
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce-ubuntu-containerd

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 5, 2021
@yangjunmyfm192085 yangjunmyfm192085 force-pushed the run-test20 branch 2 times, most recently from 138bf6f to dacf884 Compare July 13, 2021 12:30
@k8s-ci-robot k8s-ci-robot removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 13, 2021
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.

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 13, 2021
pkg/scheduler/factory.go Outdated Show resolved Hide resolved
pkg/scheduler/scheduler.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 27, 2021
@yangjunmyfm192085
Copy link
Contributor Author

yangjunmyfm192085 commented Aug 27, 2021

@ahg-g, I have applied your suggestion. Could you take a look again? Thanks.

@yangjunmyfm192085
Copy link
Contributor Author

/retest

@yangjunmyfm192085
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce-ubuntu-containerd

pkg/scheduler/util/utils.go Outdated Show resolved Hide resolved
Signed-off-by: JunYang <yang.jun22@zte.com.cn>
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.

It has been updated@ahg-g

@ahg-g
Copy link
Member

ahg-g commented Aug 30, 2021

/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 Aug 30, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, 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 Aug 30, 2021
@k8s-ci-robot k8s-ci-robot merged commit 7282c20 into kubernetes:master Aug 30, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Aug 30, 2021
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on. wg/structured-logging Categorizes an issue or PR as relevant to WG Structured Logging.
Development

Successfully merging this pull request may close these issues.

None yet

7 participants