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 logging in Controllers by adding relevant context #1880

Closed
bacherfl opened this issue Aug 11, 2023 · 6 comments · Fixed by #2253, #2269, #2279 or #2283
Closed

Improve logging in Controllers by adding relevant context #1880

bacherfl opened this issue Aug 11, 2023 · 6 comments · Fixed by #2253, #2269, #2279 or #2283
Assignees
Labels
chore Maintenance good first issue Good for newcomers
Milestone

Comments

@bacherfl
Copy link
Member

bacherfl commented Aug 11, 2023

Details

Right now, the controllers often produce logs that do not provide much value, due to missing context. A good example for that is this one:

This will generate something like:

2023-08-10T14:28:25Z	INFO	KeptnAppVersion Controller	Searching for Keptn App Version

On one side, this is helpful to indicate the start of a new reconciliation loop, but does not help much if I want to use the logs for debugging the reconciliation of a particular object in a cluster with a large number of resources. In some other places, this is done better by making use of the keysAndValues parameter of the logger's logging functions, where a list of keys and values is attached to a log line, as in the following:

2023-08-10T14:28:25Z	INFO	owner of pod is not supported by lifecycle controller	{"webhook": "/mutate-v1-pod", "object": {"kind":{"group":"","version":"v1","kind":"Pod"},"name":"","namespace":"kuttl-test-hot-gar"}, "namespace": "kuttl-test-hot-gar", "pod": ""}

Adding this context makes it way easier to actually use the logs for troubleshooting by filtering on e.g. a certain namespace, or the name of a resource.

The goal of this ticket should be to figure out a set of properties that should be attached to each log line, and make these available via a common function. Properties like name, namespace kind are good candidates, but others may also prove to be useful.

DoD

  • One PR per operator: lifecycle, cert-manager, metrics, scheduler
  • Log lines produced by the controllers contain contextual information which can be used to efficiently troubleshoot issues using the logs
@bacherfl bacherfl added the status: ready-for-refinement Issue is relevant for the next backlog refinment label Aug 11, 2023
@thisthat thisthat added the chore Maintenance label Aug 16, 2023
@thisthat thisthat added this to the 1.0.x milestone Aug 16, 2023
@thisthat thisthat added good first issue Good for newcomers and removed status: ready-for-refinement Issue is relevant for the next backlog refinment labels Aug 16, 2023
@thisthat thisthat moved this to 🎟️ Refined in Keptn Lifecycle Toolkit Aug 16, 2023
@ShivangShandilya
Copy link
Contributor

I would like to work on this @bacherfl

@thisthat
Copy link
Member

@sudiptob2 this is the issue we discussed

@geoffrey1330
Copy link
Member

@thisthat Could you please assign this issue to me

@bacherfl
Copy link
Member Author

reopening because the merged PR #2253 is part of the issue, but the other operators remain to be improved

@ShivangShandilya
Copy link
Contributor

ShivangShandilya commented Oct 13, 2023

@geoffrey1330 you gotta explain to me how you solved this issue 😄
Would help me a ton

@geoffrey1330
Copy link
Member

@geoffrey1330 you gotta explain to me how you solved this issue 😄 Would help me a ton

Sure. you can hit me up on keptn slack channel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment