Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

Add logger to actuators #27

Merged
merged 1 commit into from
Jul 2, 2019
Merged

Conversation

amy
Copy link
Contributor

@amy amy commented Jun 25, 2019

This PR partially addresses: #22
Specifically this adds loggers to the actuators.

The pattern used here was inspired by the aws provider. Ex: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/master/pkg/cloud/aws/actuators/cluster/actuator.go#L41

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 25, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 25, 2019
@amy
Copy link
Contributor Author

amy commented Jun 25, 2019

/assign @chuckha

This is a beginning sketch of how we can handle logging for the actuators. Please review and share your thoughts about the general direction.

Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

few comments

actuators/machine.go Outdated Show resolved Hide resolved
actuators/machine.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 26, 2019
@amy amy changed the title [WIP] Add logger to actuators Add logger to actuators Jun 26, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 26, 2019
Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

will need a few updates, but nice job removing the fmt import. that's dope.

go.mod Show resolved Hide resolved
actuators/cluster.go Outdated Show resolved Hide resolved
actuators/cluster.go Show resolved Hide resolved
@amy amy force-pushed the logging branch 3 times, most recently from 030ff22 to 2592843 Compare June 26, 2019 22:52
Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

All of the error logs need to include the stack trace.

I think there's probably a better way to do this, maybe a function like:

func (c *Cluster) handleError(err error) error {
// log stacktrace
// return err
}

actuators/cluster.go Show resolved Hide resolved
actuators/machine.go Outdated Show resolved Hide resolved
actuators/machine.go Outdated Show resolved Hide resolved
actuators/machine.go Outdated Show resolved Hide resolved
actuators/machine.go Outdated Show resolved Hide resolved
actuators/machine.go Outdated Show resolved Hide resolved
@neolit123
Copy link
Contributor

/test pull-cluster-api-provider-docker-verify

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 27, 2019
@amy
Copy link
Contributor Author

amy commented Jun 27, 2019

/retest

@k8s-ci-robot
Copy link
Contributor

@amy: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@chuckha
Copy link
Contributor

chuckha commented Jun 27, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jun 27, 2019
@chuckha
Copy link
Contributor

chuckha commented Jun 27, 2019

/retest

@chuckha
Copy link
Contributor

chuckha commented Jun 27, 2019

It looks like we're losing the stack traces, is that right? I don't want to give those up, they have been very useful during development

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 28, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 1, 2019
@amy
Copy link
Contributor Author

amy commented Jul 1, 2019

Re: stacktrace comments. I think that was a misunderstanding we cleared up?

#27 (comment)

@calebamiles
Copy link

@chuckha, @amy what's the status of https://github.com/kubernetes/klog? should we be using that here like k/k?

@ncdc
Copy link
Contributor

ncdc commented Jul 2, 2019

I'm in favor of a simplified logging interface, be it go-logr or something similar. But I would probably prefer something other than klog. Maybe zapr, since that's what kubebuilder seems to integrate by default now?

@chuckha
Copy link
Contributor

chuckha commented Jul 2, 2019

this pr is focused on plugging logr.Logger through and using a minor shim to keep stack traces around. we can swap out the klogr implementation for zapr or whatever we want later, no matter which one we pick we will be pulling in a dependency so i am not fussed either way.

From what i understand kubebuilder has done a lot of work to make the log implementation pluggable so we don't need to pick zapr because they do.

Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

lgtm, just missing the license on one file

logger/logger.go Show resolved Hide resolved
Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

/approve

thank you!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amy, chuckha

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 2, 2019
Copy link
Contributor

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

/lgtm
not a big fan of logr, but +1 on having a logger shim as early as possible!

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 2, 2019
@k8s-ci-robot k8s-ci-robot merged commit f60f797 into kubernetes-retired:master Jul 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants