Skip to content

Enable log config for the metrics agent#1104

Merged
mogren merged 1 commit intoaws:masterfrom
mogren:fix-metrics-logging
Aug 3, 2020
Merged

Enable log config for the metrics agent#1104
mogren merged 1 commit intoaws:masterfrom
mogren:fix-metrics-logging

Conversation

@mogren
Copy link
Copy Markdown
Contributor

@mogren mogren commented Jul 27, 2020

Issue #, if available:
#1089

Description of changes:
The cni-metrics-helper should check the same logging config env variable as ipamd does to get the log level. Will still log to stdout after this change.

  • cni-metrics-helper will get the LogLevel from env variable AWS_VPC_K8S_CNI_LOGLEVEL
  • Lowered the log level of full aggregated CloudWatch data to Debug
  • Default empty logFilePath to stdout in Zap config

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

Copy link
Copy Markdown
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.

++ couple suggestions if you want to address in a future patch.

}

func processHistogram(metric *dto.Metric, act *metricsAction) {
func processHistogram(metric *dto.Metric, act *metricsAction, log logger.Logger) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is fine. might be a bit cleaner, though, to make this function a method on metricsTarget struct versus adding a log parameter to all these functions. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree, but since metricsTarget is an interface, it will be a somewhat bigger change. Will check in a follow up PR how that would look like. 😄


func (target *testMetricsTarget) getLogger() logger.Logger {
return logger.DefaultLogger()
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you wouldn't need this interface method if you just made all those functions instead be methods on metricsTarget.

@wguto
Copy link
Copy Markdown

wguto commented Aug 3, 2020

any progress on this pr?

The cni-metrics-helper should check the same loging config env variables
as ipamd does.
@mogren mogren force-pushed the fix-metrics-logging branch from 1a4334c to 7ee6081 Compare August 3, 2020 18:22
@mogren mogren merged commit c6c1703 into aws:master Aug 3, 2020
@mogren
Copy link
Copy Markdown
Contributor Author

mogren commented Aug 3, 2020

@wguto I was out last week, but now I'm back. 🙂

@mogren mogren deleted the fix-metrics-logging branch August 24, 2020 03:45
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