Skip to content

[previewctl] Improve logging #10436

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

Merged
merged 1 commit into from
Jun 6, 2022
Merged

[previewctl] Improve logging #10436

merged 1 commit into from
Jun 6, 2022

Conversation

ArthurSens
Copy link
Contributor

Description

To improve experience while debugging when previewctl is not behaving as it should, this PR does 2 things:

  • Adopt a better logging library.
  • Log when install-context --watch fails to install and goes for another loop

How to test

  • Create a new branch from this PR.
  • Run previewctl install-context --watch
  • Run a werft job from your new branch, so it creates a new preview

You'll notice that the watch still doesn't work as expected (for me it stops looping at some point), but at least now we know what is happening 😅

Release Notes

NONE

@@ -8,16 +8,17 @@ import (
"fmt"

"github.com/gitpod-io/gitpod/previewctl/pkg/preview"
"github.com/go-kit/log"
Copy link
Contributor

Choose a reason for hiding this comment

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

All code in Gitpod uses logrus - we even tie klog (used by Kubernetes components) back to logrus.

What's the motivation to go astray? I.e. which requirements warrant the use of a different library?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

None really, just wanted to move away from the previous 🙂

I'll update the PR to logrus

Copy link
Contributor

Choose a reason for hiding this comment

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

best use common-go/log, but using logrus directly is fine, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe adopting a big lib just for one of the features may be too much.

I've only switched to logrus for now, but if someday in the future we need tracing/metrics/pprof, then common-go sounds like a good idea 🙂

@ArthurSens ArthurSens force-pushed the as/previewctl-logging branch from c45c5a6 to 2203c43 Compare June 3, 2022 15:09
Switched log library to Logrus

Signed-off-by: ArthurSens <[email protected]>
@ArthurSens ArthurSens force-pushed the as/previewctl-logging branch from 2203c43 to 734bff4 Compare June 3, 2022 15:11
@roboquat roboquat merged commit ddae876 into main Jun 6, 2022
@roboquat roboquat deleted the as/previewctl-logging branch June 6, 2022 16:56
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.

4 participants