aws / aws-network-policy-agent

Apache License 2.0
44 stars 29 forks source link

Remove callSkip to prevent Logger.check error #254

Closed ryota-sakamoto closed 5 months ago

ryota-sakamoto commented 5 months ago

Issue #, if available:

103

Description of changes:

The message Logger.check error: failed to get caller is generated by zap when call stack is empty after filtering callerSkip https://github.com/uber-go/zap/blob/v1.27.0/logger.go#L382-L388

In previous PR https://github.com/aws/aws-network-policy-agent/pull/168, we addressed failed to get caller in the metrics server. But the error still exists because rpc handler has same issue. For our use case, we don't need to use zap.AddCallerSkip. If we remove zap.AddCallerSkip, the message is disappeared and the log includes caller.

{"level":"info","ts":"2024-04-17T15:13:30.592Z","logger":"rpc-handler","caller":"rpc/rpc_handler.go:94","msg":"Serving RPC Handler","Address":"127.0.0.1:50052"}

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