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

Use structured logs in kubeapp-apis service #4949

Merged

Conversation

akankshakumari393
Copy link
Contributor

@akankshakumari393 akankshakumari393 commented Jun 23, 2022

Description of the change

This PR uses structured logs wherever possible. The changes are scoped to kubeapp-apis service and dependent package.

Benefits

Using structured logs would make automated parsing of the logs easy

Possible drawbacks

NA

Applicable issues

Additional information

@netlify
Copy link

netlify bot commented Jun 23, 2022

Deploy Preview for kubeapps-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 05309b0
🔍 Latest deploy log https://app.netlify.com/sites/kubeapps-dev/deploys/62bc37a3ecc6ff000896cf44
😎 Deploy Preview https://deploy-preview-4949--kubeapps-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@antgamdia antgamdia left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for the effort! LGTM
However, I've carried out a quick search of log.Infof(, log.Info(, log.Errorf and there are still some matches in the source code. Do you have intentions to also update them?

Besides, we also have log.Warning(, log.Warningf(, but according to klog (ErrorS structured logs to the ERROR, WARNING, and INFO logs.), it seems that the warnings are also logged using the ErrorS.

Happy to accept and land this PR or leave it open if you want to send more changes and move every log trace to the structured format.

Again, thanks for the effort :)

@akankshakumari393
Copy link
Contributor Author

akankshakumari393 commented Jun 29, 2022

Hey @antgamdia I agree that there are still some references of log.Infof(, log.Info(, log.Errorf but they are using custom formatting. So was not sure If we should make changes in that. I think we should get this PR merged. Meanwhile I will raise a seperate PR for leftover matches in a 2nd PR for kubeapps-apis service. Then we would move to other services.

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>

Conflicts:
	cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/cache/chart_cache.go
	cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/github_oci_repo_lister.go
	cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/oci_repo.go
@antgamdia
Copy link
Contributor

. I think we should get this PR merged. Meanwhile I will raise a seperate PR for leftover matches in a 2nd PR for kubeapps-apis service.

Great! Will do that way then. After the v2.4.6 release we have started merging pending PRs we had, so some conflicts have emerged. However, I've just solved them and as soon as the CI check go green, I'll merge the PR :)

@akankshakumari393
Copy link
Contributor Author

Cool, Thanks for quick response.

@antgamdia antgamdia merged commit fd39bbf into vmware-tanzu:main Jun 29, 2022
@gfichtenholt
Copy link
Contributor

Please finish this work. In the the current state it is difficult to read the server log because of inconsistent formatting of the messages, e.g.:

I0719 06:22:34.003030       1 watcher_cache.go:563] -syncHandler(helmrepositories:default:my-podinfo-3z9x)
I0719 06:22:34.003071       1 watcher_cache.go:301] -processNextWorkItem()
I0719 06:22:34.003085       1 watcher_cache.go:256] +processNextWorkItem()
I0719 06:22:34.014161       1 watcher_cache.go:649] "+fetchForOne" key="helmrepositories:default:my-podinfo-3z9x"

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.

Use structured logs (log.InfoS(...))
3 participants