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

Enable log config for the metrics agent #1104

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

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

@@ -121,7 +117,7 @@ func processPercentile(metric *dto.Metric, act *metricsAction) {
act.actionFunc(&act.data.curSingleDataPoint, p99)
}

func processHistogram(metric *dto.Metric, act *metricsAction) {
func processHistogram(metric *dto.Metric, act *metricsAction, log logger.Logger) {
Copy link
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
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. 😄

)

type testMetricsTarget struct {
metricFile string
interestingMetrics map[string]metricsConvert
}

func (target *testMetricsTarget) getLogger() logger.Logger {
return logger.DefaultLogger()
}
Copy link
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

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 merged commit c6c1703 into aws:master Aug 3, 2020
@mogren
Copy link
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