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

[noderesourcetopology] complete the contextual logging integration #725

Merged

Conversation

ffromani
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This is the second and last part of the contextual logging/logr porting/log cleanup tracked in #709 and begun in #710 . Working on #710, addressing the review comments, and reviewing the changes in kube 1.28 and beyond (see #712) lead to the realization that some better integration is desirable. That's completed in this PR.

Which issue(s) this PR fixes:

Related to #709

Special notes for your reviewer:

Further minor tweaks of the log levels of some key messages are planned, but the vast majority of the work is considered done with this PR.

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Apr 23, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ffromani

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 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 23, 2024
Copy link

netlify bot commented Apr 23, 2024

Deploy Preview for kubernetes-sigs-scheduler-plugins canceled.

Name Link
🔨 Latest commit 7098181
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-scheduler-plugins/deploys/66388aa62551140008d977b8

@ffromani
Copy link
Contributor Author

/cc @PiotrProkop second and final part of the work begun in #710

@ffromani ffromani changed the title WIP: nrt: finalize klog support WIP: [noderesourcetopology] complete the contextual logging integration Apr 23, 2024
@ffromani
Copy link
Contributor Author

everything but the last commit is final and ready for review. Still ironing out the last commit.

@ffromani ffromani force-pushed the klog-contextual-logging branch 5 times, most recently from 339ec79 to 11b0b81 Compare April 24, 2024 09:29
@ffromani ffromani changed the title WIP: [noderesourcetopology] complete the contextual logging integration [noderesourcetopology] complete the contextual logging integration Apr 24, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 24, 2024
@ffromani
Copy link
Contributor Author

/hold

I'm now happy with all the changes, but holding while my own final testing is ongoing

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 24, 2024
@ffromani
Copy link
Contributor Author

/hold

after further clarifications about the contextual logging

@ffromani ffromani changed the title [noderesourcetopology] complete the contextual logging integration WIP: [noderesourcetopology] complete the contextual logging integration Apr 24, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 24, 2024
@ffromani ffromani force-pushed the klog-contextual-logging branch 3 times, most recently from 6392841 to f1d81da Compare April 30, 2024 10:07
@ffromani ffromani changed the title WIP: [noderesourcetopology] complete the contextual logging integration [noderesourcetopology] complete the contextual logging integration Apr 30, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 30, 2024
@ffromani
Copy link
Contributor Author

finally ready. Further tunings will be deferred to future PRs.

@ffromani
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 30, 2024
@ffromani
Copy link
Contributor Author

I'd be happy to squash commits as reviewers suggest

Copy link
Contributor

@PiotrProkop PiotrProkop left a comment

Choose a reason for hiding this comment

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

Great work! LGTM after squash :)

@ffromani
Copy link
Contributor Author

squashed and reformatted the commit message.

@PiotrProkop
Copy link
Contributor

Sorry for the delay!
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 6, 2024
@ffromani
Copy link
Contributor Author

ffromani commented May 6, 2024

Sorry for the delay! /lgtm

NP, need rebase anyway :)

After more review and conversations, we have a better
understanding of how integration with contextual logging
should loom like.
First and foremost, injecting loggers would conflict with
the very goals of contextual logging.
So, let's drop this code we added in kubernetes-sigs#710.

The contextual logger doesn't do key/values deduplication.
This is let to (some) backends. To avoid log clutter,
trim down the extra key/value pairs and add only those we
really need to ensure a good troubleshooting experience.

Still let's make sure to add critical key/value
pairs in the relevant entries, at cost of a possible
duplication.

When reporting the current assumed resources, the current
representation is neither concise nor very human friendly.
Additionally, multi-line log entries are harder to process
and should be avoided.
So let's move to a more concise representation, which turns
out not obviously less human friendly and is no longer multiline.

Review verbosiness of log entries.
Move down to verbose=2 logs which are really key to understand
the behavior. We should set a hard limit to log entries to minimize
the log spam while keeping at least some observability without
requiring v=4 or greater.

The level v=4 is usually/often the highest-not-spammy log.
When debug logs are needed we often set v=4, and higher verbosity
levels are often used only in desperate times.
Thus, promote to v=4 the debug logs we should really see.

Everywhere else in the kubernetes ecosystem, and most
notably in the scheduler, the pod namespace/name pair is called
"pod", while we called it "logID".
We do it to use the same name for all the flows, being the
cache resync (which is driven by time, not by an object) the
odd one.

It seems better to be externally consistent (with the ecosystem)
rather than internally consistent (all the flows in the same plugin),
so we rename "logID" to "pod" in the log entries.

Signed-off-by: Francesco Romani <fromani@redhat.com>
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 6, 2024
@Tal-or
Copy link
Contributor

Tal-or commented May 6, 2024

/lgtm
Thanks

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2024
@k8s-ci-robot k8s-ci-robot merged commit d9728ed into kubernetes-sigs:master May 6, 2024
10 checks passed
@ffromani ffromani deleted the klog-contextual-logging branch May 6, 2024 11:17
@ffromani ffromani mentioned this pull request May 22, 2024
4 tasks
ffromani added a commit to ffromani/scheduler-plugins that referenced this pull request May 27, 2024
before kubernetes-sigs#710 and kubernetes-sigs#725, we logged the container being processed alongside
the pod (identified by namespace/name pair).
It was dropped by mistake and not deliberately.
This is useful information when troubleshooting, so let's add it back.

Signed-off-by: Francesco Romani <fromani@redhat.com>
ffromani added a commit to ffromani/scheduler-plugins that referenced this pull request May 27, 2024
before kubernetes-sigs#710 and kubernetes-sigs#725, we logged the container being processed alongside
the pod (identified by namespace/name pair).
It was dropped by mistake and not deliberately.
This is useful information when troubleshooting, so let's add it back.

Signed-off-by: Francesco Romani <fromani@redhat.com>
ffromani added a commit to ffromani/scheduler-plugins that referenced this pull request May 29, 2024
before kubernetes-sigs#710 and kubernetes-sigs#725, we logged the container being processed alongside
the pod (identified by namespace/name pair).
It was dropped by mistake and not deliberately.
This is useful information when troubleshooting, so let's add it back.

Signed-off-by: Francesco Romani <fromani@redhat.com>
ffromani added a commit to openshift-kni/scheduler-plugins that referenced this pull request May 29, 2024
before kubernetes-sigs#710 and kubernetes-sigs#725, we logged the container being processed alongside
the pod (identified by namespace/name pair).
It was dropped by mistake and not deliberately.
This is useful information when troubleshooting, so let's add it back.

Signed-off-by: Francesco Romani <fromani@redhat.com>
(cherry picked from commit 7a8afdf)
ichbinblau pushed a commit to ichbinblau/scheduler-plugins that referenced this pull request Jun 24, 2024
before kubernetes-sigs#710 and kubernetes-sigs#725, we logged the container being processed alongside
the pod (identified by namespace/name pair).
It was dropped by mistake and not deliberately.
This is useful information when troubleshooting, so let's add it back.

Signed-off-by: Francesco Romani <fromani@redhat.com>
AlleNeri pushed a commit to AlleNeri/scheduler-plugins that referenced this pull request Jul 26, 2024
before kubernetes-sigs#710 and kubernetes-sigs#725, we logged the container being processed alongside
the pod (identified by namespace/name pair).
It was dropped by mistake and not deliberately.
This is useful information when troubleshooting, so let's add it back.

Signed-off-by: Francesco Romani <fromani@redhat.com>
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. release-note-none Denotes a PR that doesn't merit a release note. 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.

None yet

4 participants