Skip to content

Implement leveled logging - #895

Merged
russellb merged 4 commits into
metallb:mainfrom
utkuozdemir:leveled-logging
Jul 14, 2021
Merged

Implement leveled logging#895
russellb merged 4 commits into
metallb:mainfrom
utkuozdemir:leveled-logging

Conversation

@utkuozdemir

Copy link
Copy Markdown

Signed-off-by: Utku Ozdemir uoz@protonmail.com

This PR implements leveled logging. I set the levels as I've seen fit by looking at their messages - any feedbacks are appreciated.
Fixes #254
Fixes #655

@gclawes

gclawes commented Jun 18, 2021

Copy link
Copy Markdown
Contributor

Should we update the helm charts and manifests to add the --log-level flag?

@utkuozdemir

Copy link
Copy Markdown
Author

Should we update the helm charts and manifests to add the --log-level flag?

Agreed and added.

What do you think about using info as the default value? On one hand it's a reasonable default, on the other hand if you want to keep the logging behavior unchanged, all or debug can do that.

@champtar

Copy link
Copy Markdown
Contributor

On my phone, but I think I would bump many debug to info, all the ones that show a change in the system. The most spam comes from memberlist, then service sync I think.

@utkuozdemir

Copy link
Copy Markdown
Author

@champtar
Thanks. Please see my latest commit which bumps some of the logs from debug to info.
With this change, debug level is used for logs that tell about:

  • the starts and ends of operations
  • no-ops ("nothing to do"s)

The operations that inform about a change/update etc. are now using the info level.

Comment thread internal/speakerlist/speakerlist.go Outdated

@champtar champtar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some nitpicks
After those changes LGTM

Comment thread controller/main.go Outdated
Comment thread controller/service.go Outdated
Comment thread controller/service.go Outdated
Comment thread internal/bgp/bgp.go Outdated
Comment thread internal/k8s/k8s.go Outdated
Comment thread internal/layer2/ndp.go Outdated
Comment thread internal/logging/logging.go Outdated
Comment thread internal/speakerlist/speakerlist.go Outdated
Comment thread speaker/bgp_controller.go Outdated
Comment thread speaker/main.go Outdated
@utkuozdemir

Copy link
Copy Markdown
Author

@champtar applied the changes you requested in the last 2 commits. Please check.

Comment thread controller/service.go Outdated
Comment thread controller/main.go
@champtar

champtar commented Jul 8, 2021

Copy link
Copy Markdown
Contributor

And if you can squash your commits a bit that would be perfect :)

@champtar champtar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not tested but LGTM !

@utkuozdemir utkuozdemir left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thanks

@russellb russellb added this to the v0.11.0 milestone Jul 12, 2021
Comment thread charts/metallb/values.yaml
@champtar

champtar commented Jul 12, 2021

Copy link
Copy Markdown
Contributor

@russellb did you delete some of your reviews ? I got email notification that I can't find in here

@russellb

Copy link
Copy Markdown
Contributor

@russellb did you delete some of your reviews ? I got email notification that I can't find in here

yeah, sorry. Commented on some, changed my mind, deleted, and now going back through and will post them all together as a single "review". I probably should have just replied to myself on here.

@champtar champtar mentioned this pull request Jul 12, 2021
1 task

@russellb russellb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me. I spotted one additional message I would have chosen debug, but the rest looked good. I started taking notes on messages I'd like to change in follow-ups but stopped since none of them are really related to these changes.

Comment thread controller/main.go
Comment thread controller/main.go
Comment thread internal/k8s/k8s.go
c.syncFuncs = append(c.syncFuncs, c.epInformer.HasSynced)
} else {
c.logger.Log("op", "New", "msg", "using endpoint slices")
level.Info(c.logger).Log("op", "New", "msg", "using endpoint slices")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd go with debug here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Endpoint slices are still new in MetalLB so it's a good information to have in bug report for now IMO.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(and it's just 1 line)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess so, but it's an implementation detail that shouldn't matter unless something is broken (like many other debug logs).

Like you said, it's just 1 line so I don't feel that strongly ...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Should I do this change? Or you can do it directly.

@russellb

Copy link
Copy Markdown
Contributor

... CI doesn't seem to have run on this PR? I have no idea why.

Utku Ozdemir added 2 commits July 12, 2021 16:46
Signed-off-by: Utku Ozdemir <uoz@protonmail.com>
Signed-off-by: Utku Ozdemir <uoz@protonmail.com>
@russellb

Copy link
Copy Markdown
Contributor

I pushed a rebase of this PR to the branch to try to trigger CI and it seems to have worked

Signed-off-by: Utku Ozdemir <uoz@protonmail.com>
@utkuozdemir

Copy link
Copy Markdown
Author

Some of my changes seems to have disappeared - I think it was caused by the rebase somehow, but not sure. I have (re)pushed those changes in the latest commit.

@russellb

Copy link
Copy Markdown
Contributor

Some of my changes seems to have disappeared - I think it was caused by the rebase somehow, but not sure. I have (re)pushed those changes in the latest commit.

I apologize if I overwrote something. I thought I was up to date from your branch before I did the rebase. In any case, it seems CI is running (and passing) now. FWIW, I saw those same failures locally when I pulled down this PR to test it, so maybe those build fixes hadn't been pushed?

@utkuozdemir

Copy link
Copy Markdown
Author

Some of my changes seems to have disappeared - I think it was caused by the rebase somehow, but not sure. I have (re)pushed those changes in the latest commit.

I apologize if I overwrote something. I thought I was up to date from your branch before I did the rebase. In any case, it seems CI is running (and passing) now. FWIW, I saw those same failures locally when I pulled down this PR to test it, so maybe those build fixes hadn't been pushed?

No problem at all.

I just think internal/speakerlist/log.go went missing, because I added it as @champtar 's request, and I think he saw it: #895 (comment)

Or it might be my squash that made it disappear 🤔

But anyway, doesn't matter - all back in their place now :)

@russellb

Copy link
Copy Markdown
Contributor

I'm trying to build this locally to look at logs and it's failing. Any idea why?

$ inv dev-env -p layer2
kind version
kind v0.10.0 go1.15.7 linux/amd64
go build -v -o build/amd64/controller/controller -ldflags '-X go.universe.tf/metallb/internal/version.gitCommit=25e1592a -X go.universe.tf/metallb/internal/version.gitBranch=pr-895' go.universe.tf/metallb/controller
go.universe.tf/metallb/internal/logging
# go.universe.tf/metallb/internal/logging
internal/logging/logging.go:56:14: level.NewFilter undefined (type string has no field or method NewFilter)
internal/logging/logging.go:147:15: level.AllowAll undefined (type string has no field or method AllowAll)
internal/logging/logging.go:149:15: level.AllowDebug undefined (type string has no field or method AllowDebug)
internal/logging/logging.go:151:15: level.AllowInfo undefined (type string has no field or method AllowInfo)
internal/logging/logging.go:153:15: level.AllowWarn undefined (type string has no field or method AllowWarn)
internal/logging/logging.go:155:15: level.AllowError undefined (type string has no field or method AllowError)
internal/logging/logging.go:157:15: level.AllowNone undefined (type string has no field or method AllowNone)
$ go version
go version go1.16.4 linux/amd64

@utkuozdemir

Copy link
Copy Markdown
Author

It was fixed by my last commit: 93208e2

Specifically, by the rename level -> lvl.

Can you delete your local branch and checkout again the remote branch? Might help.

@russellb

Copy link
Copy Markdown
Contributor

It was fixed by my last commit: 93208e2

Specifically, by the rename level -> lvl.

Can you delete your local branch and checkout again the remote branch? Might help.

oops, you're right. :-D thanks

@russellb

Copy link
Copy Markdown
Contributor

OK, last request, I think ... would you mind adding an entry to the "New Features" section of the release notes about this? I would note that leveled logging is now supported, what the default behavior using our helm chart or manifests, and how someone would go about changing it as needed.

See website/content/release-notes/_index.md

Signed-off-by: Utku Ozdemir <uoz@protonmail.com>
@utkuozdemir

Copy link
Copy Markdown
Author

OK, last request, I think ... would you mind adding an entry to the "New Features" section of the release notes about this? I would note that leveled logging is now supported, what the default behavior using our helm chart or manifests, and how someone would go about changing it as needed.

See website/content/release-notes/_index.md

Done, but feel free to change the wording as you see fit.

@russellb

Copy link
Copy Markdown
Contributor

OK, last request, I think ... would you mind adding an entry to the "New Features" section of the release notes about this? I would note that leveled logging is now supported, what the default behavior using our helm chart or manifests, and how someone would go about changing it as needed.
See website/content/release-notes/_index.md

Done, but feel free to change the wording as you see fit.

looks good to me. Thank you for all of your work!

@russellb
russellb merged commit 95f6562 into metallb:main Jul 14, 2021
@utkuozdemir

Copy link
Copy Markdown
Author

Thanks! Happy to contribute :)

@utkuozdemir
utkuozdemir deleted the leveled-logging branch July 14, 2021 17:58
@zigmund

zigmund commented Jul 16, 2021

Copy link
Copy Markdown

@utkuozdemir, thanks for the fix.

@russellb, are you going to release this in near future?

@russellb

Copy link
Copy Markdown
Contributor

I'll probably wait a bit. We just did a feature release (0.10) pretty recently, so I figure we'd wait a bit longer to get some other stuff in first.

@cjreyn

cjreyn commented Sep 15, 2021

Copy link
Copy Markdown

Thank you for all the good work on Metallb. We're using it heavily to support science in the UK at Diamond Light Source!
Do you have any idea which release this PR is planned for?

@curantes

Copy link
Copy Markdown

Thank you for all the good work on Metallb. We're using it heavily to support science in the UK at Diamond Light Source!
Do you have any idea which release this PR is planned for?

v0.11.0 according to the milestone and release date have not been announced what I know of.

disclaimer: I am not part of metallb project

@zigmund

zigmund commented Sep 15, 2021

Copy link
Copy Markdown

It's really long-waited fix for big amounts of users, please release.

@jonaz

jonaz commented Oct 19, 2021

Copy link
Copy Markdown

Still get about 10 million logs per day from metallb so this would really offload our logging infrastructure! <3
Looking forward to having this feature released!

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.

Any way to reduce log level/verbosity Verbosity controls for MetalLB logs

8 participants