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

Improve operator logging #477

Merged

Conversation

zeeke
Copy link
Member

@zeeke zeeke commented Jul 14, 2023

This PR improves the logging system of the operator:

a. sigs.k8s.io/controller-runtime/pkg/log/zap logging system needs a TimeEncoder to be set, so log lines change from:

1.6893201843653495e+09	INFO	Starting EventSource	{"controller": "sriovibnetwork"...

to

2023-07-14T09:49:58.358957635Z	INFO	Starting EventSource	{"controller":  ...

b. Avoid logging in helper functions
c. renderDevicePluginConfigData() was logging a growing ResourceList array in a loop, leading to excessive logging when the cluster has 20+ policies.

Set a TimeEncoder for zap logging system
to have more speaking timestamp.

from `1.6893201844680622e+09` to
`2023-07-14T09:52:29.539392293Z`

Signed-off-by: Andrea Panattoni <[email protected]>
In `renderDevicePluginConfigData()`, avoid
logging the full ResourceList for every resource in the loop.

Avoid logging in helper functions, as they can be invoked in loops.

Signed-off-by: Andrea Panattoni <[email protected]>
@github-actions
Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 5554171225

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.003%) to 24.464%

Files with Coverage Reduction New Missed Lines %
controllers/sriovnetwork_controller.go 4 63.81%
Totals Coverage Status
Change from base Build 5543038988: 0.003%
Covered Lines: 2078
Relevant Lines: 8494

💛 - Coveralls

@liornoy
Copy link
Contributor

liornoy commented Jul 16, 2023

lgtm

Copy link
Contributor

@cgoncalves cgoncalves left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@e0ne e0ne left a comment

Choose a reason for hiding this comment

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

LGTM. @zeeke thanks for this improvement!

@bn222
Copy link
Collaborator

bn222 commented Jul 19, 2023

We are using a mix of different loggers. I see there is also glog.V(2).Infof in different parts of the code. I'm wondering if this is the right time (same PR) to clean that up too.

@adrianchiris
Copy link
Collaborator

We are using a mix of different loggers. I see there is also glog.V(2).Infof in different parts of the code. I'm wondering if this is the right time (same PR) to clean that up too.

we should definitely have a consistency with logging across different components in the operator. perhaps create an issue about it ?

LGTM, merging this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants