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

source/custom: dump config in more human-readable form #473

Merged
merged 1 commit into from
Mar 17, 2021

Conversation

marquiz
Copy link
Contributor

@marquiz marquiz commented Mar 10, 2021

You get log entries like this (with -v 1):

I0310 21:59:19.778694   12976 custom.go:84] custom features configuration:
I0310 21:59:19.778963   12976 custom.go:84]   - matchOn:
I0310 21:59:19.778981   12976 custom.go:84]     - pciId:
I0310 21:59:19.778985   12976 custom.go:84]         vendor:
I0310 21:59:19.778988   12976 custom.go:84]         - 15b3
I0310 21:59:19.778991   12976 custom.go:84]     name: rdma.capable
I0310 21:59:19.778994   12976 custom.go:84]   - matchOn:
I0310 21:59:19.778997   12976 custom.go:84]     - loadedKMod:
I0310 21:59:19.779000   12976 custom.go:84]       - ib_uverbs
I0310 21:59:19.779004   12976 custom.go:84]       - rdma_ucm
I0310 21:59:19.779009   12976 custom.go:84]     name: rdma.available
I0310 21:59:19.779015   12976 custom.go:84]   - matchOn:
I0310 21:59:19.779018   12976 custom.go:84]     - kConfig:
I0310 21:59:19.779023   12976 custom.go:84]       - X86
I0310 21:59:19.779026   12976 custom.go:84]     name: kconfig-test

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 10, 2021
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 10, 2021
@marquiz
Copy link
Contributor Author

marquiz commented Mar 10, 2021

For development this is nice. Dunno about production 🤔
/hold

@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 Mar 10, 2021
@ArangoGutierrez
Copy link
Contributor

For development this is nice. Dunno about production thinking
/hold

maybe -v 2 ? a debug lvl log is always helpful. I like it. sometimes we need to know what the users did. although we could jjust check the configMap.
I would say -v 2 is a safe bet

@marquiz
Copy link
Contributor Author

marquiz commented Mar 12, 2021

maybe -v 2 ? a debug lvl log is always helpful. I like it. sometimes we need to know what the users did. although we could jjust check the configMap.
I would say -v 2 is a safe bet

What I was merely pondering was the oneline vs multi-line format. Multi-line is not that friendly for external log servers (I think). There would be some options to tackle this if we . One would be to dump a oneliner with -v 1 and multi-line with v -2. Another solution would be to have another config option for controlling this

@ArangoGutierrez
Copy link
Contributor

maybe -v 2 ? a debug lvl log is always helpful. I like it. sometimes we need to know what the users did. although we could jjust check the configMap.
I would say -v 2 is a safe bet

What I was merely pondering was the oneline vs multi-line format. Multi-line is not that friendly for external log servers (I think). There would be some options to tackle this if we . One would be to dump a oneliner with -v 1 and multi-line with v -2. Another solution would be to have another config option for controlling this

What about a nfd-worker dump command, I like this patch main idea, bc I think when I am in the pod doing some debugging , so why not to have a way to simple call the binary and retrieve the config and maybe other info that can help to fix a problem

@marquiz
Copy link
Contributor Author

marquiz commented Mar 15, 2021

What about a nfd-worker dump command

Why not, something like that would probably be useful. But, I think that's a separate issue from this one (Could you open an issue about that?)

This PR is about making the existing debug print more readable.

@ArangoGutierrez
Copy link
Contributor

What about a nfd-worker dump command

Why not, something like that would probably be useful. But, I think that's a separate issue from this one (Could you open an issue about that?)

This PR is about making the existing debug print more readable.

my concern with this PR is that the custom config is a config map, I don't see the value of printing it on the logs, if you can kubectl get cm/blablabla -o yaml or inside the pod go to the mounted path and read it.
Printing a custom config would make logs really long and hard to read, more when working on a remote terminal or something.
Not so sure we want this many logs
Any thoughts other reviewers?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 15, 2021
@marquiz
Copy link
Contributor Author

marquiz commented Mar 16, 2021

my concern with this PR is that the custom config is a config map,

It's not just a configmap. It's composed of several sources: the static rules, main config file and extra rules under /etc/kubernetes/node-feature-discovery/custom.d.

Printing a custom config would make logs really long and hard to read, more when working on a remote terminal or something.
Not so sure we want this many logs

This is more of a debugging aid (and should probably be -v 2). I think it is useful to be able to see the complete list of rules that are present. That said, I also understand the viewpoint that this log message should be removed completely. Then there's the option I mentioned about multi-line vs. single-line (json?) dumps 🤔

Also, increase the verbosity level to 2 because this can produce quite a
bunch of log message lines.
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 16, 2021
@marquiz
Copy link
Contributor Author

marquiz commented Mar 16, 2021

Rebased and increased log level to 2.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2021
Copy link
Contributor

@ArangoGutierrez ArangoGutierrez left a comment

Choose a reason for hiding this comment

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

As level 2 I like this idea
looks good to me (lgtm)
WDYT @Ethyling

@jjacobelli
Copy link
Contributor

WDYT @Ethyling

LGTM
Should we merge it for the v0.8 release?

@ArangoGutierrez
Copy link
Contributor

WDYT @Ethyling

LGTM
Should we merge it for the v0.8 release?

I am ok with it being in the release, more since we are getting the core-config feature, debugging NFD in prod systems, this will help
Thoughts
@marquiz

Copy link
Contributor

@ArangoGutierrez ArangoGutierrez left a comment

Choose a reason for hiding this comment

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

Since 2 reviewers already gave lgtm, I am creating the flag but not removing the hold label
Leaving the unhold to Marquiz
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 17, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ArangoGutierrez, marquiz

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

@marquiz
Copy link
Contributor Author

marquiz commented Mar 17, 2021

Thanks for the reviews! I think we can merge this, especially as it's -v 2 and far from enabled by default
/unhold

@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 Mar 17, 2021
@k8s-ci-robot k8s-ci-robot merged commit c7442f8 into kubernetes-sigs:master Mar 17, 2021
@marquiz marquiz mentioned this pull request Mar 17, 2021
32 tasks
@marquiz marquiz deleted the devel/log-readability branch March 18, 2021 14:50
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. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants