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

Zap logger #824

Merged
merged 1 commit into from
Mar 23, 2020
Merged

Zap logger #824

merged 1 commit into from
Mar 23, 2020

Conversation

nithu0115
Copy link
Contributor

@nithu0115 nithu0115 commented Jan 31, 2020

Issue #, if available: #511

Description of changes:
Adding zap logger

  • Added zap logger
  • Parameterize config
  • Update Readme
  • Unit tests

Outputs

Screen Shot 2020-03-16 at 2 11 07 PM

Screen Shot 2020-03-16 at 2 19 55 PM

Screen Shot 2020-03-16 at 2 19 23 PM

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@mogren mogren left a comment

Choose a reason for hiding this comment

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

Nice work! Added a few comments so far.

Could you add some sample output in the overview as well?

pkg/utils/logger/zaplogger.go Outdated Show resolved Hide resolved
pkg/utils/logger/zaplogger.go Outdated Show resolved Hide resolved
pkg/utils/logger/zaplogger.go Outdated Show resolved Hide resolved
pkg/utils/logger/logger.go Outdated Show resolved Hide resolved
pkg/utils/logger/logger.go Outdated Show resolved Hide resolved
pkg/k8sapi/discovery.go Outdated Show resolved Hide resolved
cmd/cni-metrics-helper/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/ipamd/datastore/data_store.go Outdated Show resolved Hide resolved
pkg/ipamd/ipamd.go Outdated Show resolved Hide resolved
pkg/utils/logger/logger_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Stay with this, @nithu0115. A number of things to address but it's getting there. :)

README.md Outdated Show resolved Hide resolved
cmd/cni-metrics-helper/metrics/metrics.go Outdated Show resolved Hide resolved
cmd/cni-metrics-helper/metrics/metrics.go Outdated Show resolved Hide resolved
cmd/cni-metrics-helper/metrics/metrics.go Outdated Show resolved Hide resolved
cmd/cni-metrics-helper/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/publisher/publisher.go Outdated Show resolved Hide resolved
pkg/publisher/publisher.go Outdated Show resolved Hide resolved
pkg/publisher/publisher.go Outdated Show resolved Hide resolved
pkg/utils/logger/logger.go Outdated Show resolved Hide resolved
pkg/utils/logger/logger.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Hi @nithu0115, still some work left to do on this one...

cmd/aws-k8s-agent/main.go Outdated Show resolved Hide resolved
cmd/cni-metrics-helper/metrics/metrics.go Outdated Show resolved Hide resolved
cmd/cni-metrics-helper/metrics/metrics.go Outdated Show resolved Hide resolved
cmd/cni-metrics-helper/metrics/metrics.go Outdated Show resolved Hide resolved
cmd/cni-metrics-helper/metrics/metrics.go Outdated Show resolved Hide resolved
cmd/grpc-health-probe/main.go Outdated Show resolved Hide resolved
cmd/routed-eni-cni-plugin/cni.go Outdated Show resolved Hide resolved
cmd/routed-eni-cni-plugin/cni.go Outdated Show resolved Hide resolved
pkg/ipamd/ipamd.go Outdated Show resolved Hide resolved
scripts/entrypoint.sh Outdated Show resolved Hide resolved
Copy link
Contributor Author

@nithu0115 nithu0115 left a comment

Choose a reason for hiding this comment

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

Thanks for the review @jaypipes and sorry for the delay. I was sick 🤒 I will work on the feedback and update you.

Copy link
Contributor

@mogren mogren left a comment

Choose a reason for hiding this comment

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

Nice! Thanks a lot for all this works. Some comments... :)

const (
defaultLogFilePath = "/host/var/log/aws-routed-eni/ipamd.log"
)
const binaryName = "L-IPamD"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ipamd is a fine abbreviation of "IP Address Management Daemon". The Linux part is not needed, and neither the special casing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Heh, TIL that the "L-" stands for "Linux"...

Agreed, though, that "ipamd" is a better and more Linux-appropriate daemon name.

If you make this change in a future PR, however, please remember to update https://github.com/awslabs/amazon-eks-ami/blob/master/log-collector-script/linux/eks-log-collector.sh

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 think ipamd is a fine abbreviation of "IP Address Management Daemon". The Linux part is not needed, and neither the special casing.

I wanted it to be consistent with the log message. I can change it to "ipamd".

cmd/cni-metrics-helper/metrics/metrics.go Show resolved Hide resolved
cmd/grpc-health-probe/main.go Show resolved Hide resolved
cmd/routed-eni-cni-plugin/cni.go Show resolved Hide resolved
cmd/routed-eni-cni-plugin/driver/mocks/driver_mocks.go Outdated Show resolved Hide resolved
cmd/routed-eni-cni-plugin/driver/driver.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Only required change here is the need to restore the MTU config default check. Otherwise, looks excellent, thanks!

@nithu0115 nithu0115 force-pushed the master branch 4 times, most recently from 596375b to f0629f1 Compare March 18, 2020 23:59
@nithu0115
Copy link
Contributor Author

Updated, rebased as per your comments @jaypipes @mogren. I am planning to run a benchmark test and will post the results here.

Copy link
Contributor

@mogren mogren left a comment

Choose a reason for hiding this comment

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

Just some tiny things left, almost there!

README.md Outdated Show resolved Hide resolved
@@ -256,7 +254,7 @@ func (d *Controller) handlePodUpdate(key string) error {
d.workerPodsLock.Lock()
defer d.workerPodsLock.Unlock()

log.Tracef("Update for pod %s: %+v, %+v", podName, pod.Status, pod.Spec)
log.Debugf("Update for pod %s: %+v, %+v", podName, pod.Status, pod.Spec)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might become too verbose, since it is printing the full pod.Spec on every pod update on the node. The info level log on line 267 is probably enough.

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 would like to leave it as is for now as this will provide us some better info while troubleshooting.

pkg/publisher/publisher.go Outdated Show resolved Hide resolved
@nithu0115 nithu0115 force-pushed the master branch 5 times, most recently from cfd3162 to a00483a Compare March 19, 2020 03:19
Copy link
Contributor Author

@nithu0115 nithu0115 left a comment

Choose a reason for hiding this comment

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

Rebased, updated as per comments.

@nithu0115
Copy link
Contributor Author

@mogren @jaypipes, the original 602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon-k8s-cni:v1.6.0 compressed size is (linux/amd64) 106.27 MB and the new image which includes this commit is 90.19 MB

@jaypipes
Copy link
Contributor

@mogren @jaypipes, the original 602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon-k8s-cni:v1.6.0 compressed size is (linux/amd64) 106.27 MB and the new image which includes this commit is 90.19 MB

So, around a 15% reduction in image size. Awesome.

Copy link
Contributor

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

I'm good with this. A future commit can get rid of the DefaultLogger module-level log variables, but I think getting the number of logging libraries down to just one (and a tested, vetted one that is maintained) is worthwhile.

README.md Outdated Show resolved Hide resolved
@nithu0115 nithu0115 force-pushed the master branch 3 times, most recently from d5ef59b to 4387b7c Compare March 23, 2020 16:24
scripts/entrypoint.sh Outdated Show resolved Hide resolved
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.

3 participants