aws / aws-application-networking-k8s

A Kubernetes controller for Amazon VPC Lattice
https://www.gateway-api-controller.eks.aws.dev/
Apache License 2.0
164 stars 49 forks source link

Adding Trace IDs to log lines #624

Closed shulin-sq closed 3 months ago

shulin-sq commented 5 months ago

What type of PR is this?

Which issue does this PR fix: https://github.com/aws/aws-application-networking-k8s/issues/603

related conversation: https://github.com/uber-go/zap/issues/654

What does this PR do / Why do we need it:

If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:

Testing done on this change:

running in a development environment:

{"level":"info","ts":"2024-04-24T02:23:58.515Z","logger":"controller.route","caller":"controllers/route_controller.go:157","msg":"reconcile starting","type":"route","name":"lattice-redacted-srv-http","trace_id":"bc67d345-3b33-499a-9e3e-329e4dff92b9"}
{"level":"info","ts":"2024-04-24T02:23:58.515Z","logger":"controller.route","caller":"controllers/route_controller.go:277","msg":"Found aws-vpc-lattice for Route for lattice-redacted-srv-http, redacted-srv","trace_id":"bc67d345-3b33-499a-9e3e-329e4dff92b9"}
{"level":"info","ts":"2024-04-24T02:23:58.515Z","logger":"controller.route","caller":"controllers/route_controller.go:323","msg":"reconcile, adding or updating","name":"lattice-redacted-srv-http","trace_id":"bc67d345-3b33-499a-9e3e-329e4dff92b9"}
{"level":"info","ts":"2024-04-24T02:23:58.524Z","logger":"controller.iam-auth-policy","caller":"controllers/iamauthpolicy_controller.go:85","msg":"reconcile starting","type":"iamauthpolicy","name":"lattice-redacted-srv-http","trace_id":"ccdf0c8a-6fd0-43d6-86d4-5e4840e4a28c"}
{"level":"info","ts":"2024-04-24T02:23:58.524Z","logger":"controller.iam-auth-policy","caller":"controllers/iamauthpolicy_controller.go:96","msg":"reconcile IAM policy","req":"redacted-srv/lattice-redacted-srv-http","targetRef":{"group":"gateway.networking.k8s.io","kind":"HTTPRoute","name":"lattice-redacted-srv-http"},"tra
ce_id":"ccdf0c8a-6fd0-43d6-86d4-5e4840e4a28c"}
{"level":"info","ts":"2024-04-24T02:23:58.525Z","logger":"controller.route","caller":"gateway/model_build_lattice_service.go:122","msg":"Setting customer-domain-name: redacted-srv.global.dev.sq.lattice for route lattice-redacted-srv-http-redacted-srv","trace_id":"bc67d345-3b33-499a-9e3e-329e4dff92b9"}
{"level":"info","ts":"2024-04-24T02:24:11.292Z","logger":"controller.iam-auth-policy","caller":"controllers/iamauthpolicy_controller.go:114","msg":"reconciled IAM policy","req":"redacted-srv/lattice-redacted-srv-http","targetRef":{"group":"gateway.networking.k8s.io","kind":"HTTPRoute","name":"lattice-redacted-srv-http"},"i
sDeleted":false,"trace_id":"ccdf0c8a-6fd0-43d6-86d4-5e4840e4a28c"}
{"level":"info","ts":"2024-04-24T02:24:11.292Z","logger":"controller.iam-auth-policy","caller":"controllers/iamauthpolicy_controller.go:87","msg":"reconcile completed","name":"lattice-redacted-srv-http","type":"iamauthpolicy","trace_id":"ccdf0c8a-6fd0-43d6-86d4-5e4840e4a28c"}

Automation added to e2e:

Will this PR introduce any new dependencies?:

Will this break upgrades or downgrades. Has updating a running cluster been tested?:

Does this PR introduce any user-facing change?:

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