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

KOGITO-8276: Improve the logging adding missing levels #201

Merged
merged 25 commits into from
Aug 2, 2023

Conversation

manstis
Copy link
Contributor

@manstis manstis commented Jul 25, 2023

Description of the change:

See https://issues.redhat.com/browse/KOGITO-8276

Motivation for the change:

Consolidate logging system.

Checklist

  • Add or Modify a unit test for your change
  • Have you verified that all the tests are passing?
How to backport a pull request to a different branch?

In order to automatically create a backporting pull request please add one or more labels having the following format backport-<branch-name>, where <branch-name> is the name of the branch where the pull request must be backported to (e.g., backport-7.67.x to backport the original PR to the 7.67.x branch).

NOTE: backporting is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another.

Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.

If something goes wrong, the author will be notified and at this point a manual backporting is needed.

NOTE: this automated backporting is triggered whenever a pull request on main branch is labeled or closed, but both conditions must be satisfied to get the new PR created.

api/log/log.go Outdated Show resolved Hide resolved
api/log/log.go Outdated Show resolved Hide resolved
api/log/log.go Outdated Show resolved Hide resolved
api/log/log.go Outdated Show resolved Hide resolved
api/const.go Show resolved Hide resolved
api/log/log.go Outdated Show resolved Hide resolved
api/log/log.go Outdated Show resolved Hide resolved
container-builder/builder/kubernetes/builder.go Outdated Show resolved Hide resolved
container-builder/util/log/log.go Outdated Show resolved Hide resolved
container-builder/util/log/log.go Outdated Show resolved Hide resolved
container-builder/util/log/log.go Outdated Show resolved Hide resolved
container-builder/util/log/log.go Outdated Show resolved Hide resolved
controllers/profiles/ensurer.go Outdated Show resolved Hide resolved
controllers/profiles/profile.go Outdated Show resolved Hide resolved
@manstis
Copy link
Contributor Author

manstis commented Jul 26, 2023

@ricardozanini I'm going to need some advice here.

I had to remove klog.InitFlags(nil) from the Logger wrappers as go was panicing that a flag was being redefined.

I originally added it to ensure the v flag from the CLI was going to be detected; but it seems something somewhere is already parsing the CLI flags... To be honest the CLI argument binding mechanism in go is like black-magic to me. What should I do? Leave the initialisation in my wrappers out? Is there a different way I should have done it?

@ricardozanini
Copy link
Member

I had to remove klog.InitFlags(nil) from the Logger wrappers as go was panicing that a flag was being redefined.

That's perfectly fine. klog should be reading the go flags under the hood by the controller-runtime or apimachinanery structs. We can leave it this way since we won't override the flag for something else but follow k8s conventions. 👍

Copy link
Member

@ricardozanini ricardozanini left a comment

Choose a reason for hiding this comment

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

Nice work, many thanks! 🙏

A few minor comments. One thing that we could add to the manager deployment file, is the:

args:
  - '-v=1'

So, by default, we set the verbosity to WARN and give a clue to the administrator to fine-tune their setup.

container-builder/util/log/log.go Outdated Show resolved Hide resolved
controllers/log/log.go Outdated Show resolved Hide resolved
@manstis
Copy link
Contributor Author

manstis commented Jul 28, 2023

Hmmmm.. both failing set of tests seem to relate to both stdout and stderr being None.

2023-07-28 08:00:08,324 tools.py:366        ERROR Command '['/usr/bin/podman', 'build', '--squash', '-t', 'kogito-serverless-operator:2.0.0-snapshot', '-t', 'kogito-serverless-operator:latest', 'target/image']' returned non-zero exit status 125. Command stdout is 'None' with stderr 'None'

2023-07-28 07:56:21,295 tools.py:375        ERROR Command '['/usr/bin/podman', 'build', '--squash', '-t', 'kogito-serverless-operator:2.0.0-snapshot', '-t', 'kogito-serverless-operator:latest', 'target/image']' returned non-zero exit status 1. Command stdout is 'None' with stderr 'None'

@apache apache deleted a comment from kie-ci Aug 1, 2023
@apache apache deleted a comment from kie-ci Aug 1, 2023
@apache apache deleted a comment from kie-ci Aug 1, 2023
@apache apache deleted a comment from kie-ci Aug 1, 2023
@apache apache deleted a comment from kie-ci Aug 1, 2023
Copy link
Member

@spolti spolti left a comment

Choose a reason for hiding this comment

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

very nice, just a few comments, not mandatory.

@apache apache deleted a comment from kie-ci Aug 1, 2023
@apache apache deleted a comment from kie-ci Aug 1, 2023
@apache apache deleted a comment from kie-ci Aug 1, 2023
@manstis
Copy link
Contributor Author

manstis commented Aug 2, 2023

Hi @desmax74 this is just waiting for your final approval.

@desmax74
Copy link
Contributor

desmax74 commented Aug 2, 2023

@manstis added the request to remove the ":" where was the placeholder.

manstis and others added 4 commits August 2, 2023 10:55
Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>
Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>
Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>
Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>
@desmax74 desmax74 merged commit a50864e into apache:main Aug 2, 2023
7 checks passed
github-actions bot pushed a commit that referenced this pull request Aug 2, 2023
* KOGITO-8276: Improve the logging adding missing levels

* Add support for -zap-log-level CLI flag

* Fix function invocation.

* Updates following peer review.

* Updates following peer review x2. Remove use of logger argument.

* Remove klog.InitFlags(nil) in Logger wrappers.

* Run make generate-all

* Another refactor removing wrappers and contexts.

* More updates.

* Enable Info logging by default.

* Add missing klog dependency.

* Fix erroneous logging statements.

* Move to structured logging.

* Remove references to k8s.io/klog[v1]

* Fix build

* Fix go.sum

* Update container-builder/builder/kubernetes/builder.go

Co-authored-by: Filippe Spolti <[email protected]>

* Update container-builder/builder/kubernetes/builder.go

Co-authored-by: Filippe Spolti <[email protected]>

* Update utils/kubernetes/annotations.go

Co-authored-by: Filippe Spolti <[email protected]>

* Update controllers/builder/containerbuilder.go

Co-authored-by: Filippe Spolti <[email protected]>

* Update container-builder/client/fastmapper.go

* Update container-builder/common/registry_docker.go

Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>

* Update controllers/platform/platformutils.go

Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>

* Update controllers/platform/platformutils.go

Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>

* Update controllers/platform/platformutils.go

Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>

---------

Co-authored-by: Michael Anstis <[email protected]>
Co-authored-by: Filippe Spolti <[email protected]>
Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>
ricardozanini added a commit that referenced this pull request Aug 10, 2023
* KOGITO-8276: Improve the logging adding missing levels (#201)

* KOGITO-8276: Improve the logging adding missing levels

* Add support for -zap-log-level CLI flag

* Fix function invocation.

* Updates following peer review.

* Updates following peer review x2. Remove use of logger argument.

* Remove klog.InitFlags(nil) in Logger wrappers.

* Run make generate-all

* Another refactor removing wrappers and contexts.

* More updates.

* Enable Info logging by default.

* Add missing klog dependency.

* Fix erroneous logging statements.

* Move to structured logging.

* Remove references to k8s.io/klog[v1]

* Fix build

* Fix go.sum

* Update container-builder/builder/kubernetes/builder.go

Co-authored-by: Filippe Spolti <[email protected]>

* Update container-builder/builder/kubernetes/builder.go

Co-authored-by: Filippe Spolti <[email protected]>

* Update utils/kubernetes/annotations.go

Co-authored-by: Filippe Spolti <[email protected]>

* Update controllers/builder/containerbuilder.go

Co-authored-by: Filippe Spolti <[email protected]>

* Update container-builder/client/fastmapper.go

* Update container-builder/common/registry_docker.go

Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>

* Update controllers/platform/platformutils.go

Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>

* Update controllers/platform/platformutils.go

Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>

* Update controllers/platform/platformutils.go

Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>

---------

Co-authored-by: Michael Anstis <[email protected]>
Co-authored-by: Filippe Spolti <[email protected]>
Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>

* Fix codegen

Signed-off-by: Ricardo Zanini <[email protected]>

---------

Signed-off-by: Ricardo Zanini <[email protected]>
Co-authored-by: Michael Anstis <[email protected]>
Co-authored-by: Michael Anstis <[email protected]>
Co-authored-by: Filippe Spolti <[email protected]>
Co-authored-by: Massimiliano Dessì - (Fast Chauffeur) <[email protected]>
Co-authored-by: Ricardo Zanini <[email protected]>
Co-authored-by: Ricardo Zanini <[email protected]>
MarianMacik pushed a commit to MarianMacik/kogito-serverless-operator that referenced this pull request Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants