aws / aws-network-policy-agent

Apache License 2.0
43 stars 27 forks source link

Fix metrics logging error; Remove version log #168

Closed jdn5126 closed 8 months ago

jdn5126 commented 8 months ago

Issue #, if available: https://github.com/aws/aws-network-policy-agent/issues/103 https://github.com/aws/aws-network-policy-agent/issues/49

Description of changes: This PR fixes two issues:

  1. The metrics server runs in a goroutine. Logging was broken in the metrics server because the call stack was starting at -2 when it needed to start at 0. This PR instantiates a new logger in the metrics goroutine and resolves https://github.com/aws/aws-network-policy-agent/issues/103
  2. During init, the agent was trying to log version information. This information is not properly set, leading to https://github.com/aws/aws-network-policy-agent/issues/49. This PR removes that log, as the image tag is sufficient to determine version.

New log looks like:

% kubectl logs -n kube-system aws-node-57t4f -c aws-eks-nodeagent
{"level":"info","ts":"2023-12-26T20:57:29.306Z","caller":"metrics/metrics.go:23","msg":"Serving metrics on ","port":61680}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.