-
Notifications
You must be signed in to change notification settings - Fork 297
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
Configure contextual and structured logging for NEG controller #1746
Configure contextual and structured logging for NEG controller #1746
Conversation
Welcome @gauravkghildiyal! |
Hi @gauravkghildiyal. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @swetharepakula It would make sense to review the commits separately. The delta looks large, but the major contributor in this delta is the changes to the vendor directory introduced in the first commit "Update klog version to v2". The second commit "Add contextual logging to NEG controller and its components" is the one which includes the changes to the logs. |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Gaurav! Comments are mostly on improving the log level of log lines and some suggestions to make the log line clearer.
6473054
to
892bf61
Compare
lgtm |
pkg/neg/controller.go
Outdated
return | ||
} | ||
if endpointSlice, ok = tombstone.Obj.(*discovery.EndpointSlice); !ok { | ||
klog.Errorf("Unexpected tombstone object type: %T, expected *discovery.EndpointSlice", obj) | ||
c.logger.Error(nil, "Unexpected tombstone object type: %T, expected *discovery.EndpointSlice", "objectTypeFound", fmt.Sprintf("%T", obj)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the format %T
in the error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
pkg/neg/syncers/transaction.go
Outdated
@@ -541,16 +547,17 @@ func mergeTransactionIntoZoneEndpointMap(endpointMap map[string]negtypes.Network | |||
|
|||
// logStats logs aggregated stats of the input endpointMap | |||
func (s *transactionSyncer) logStats(endpointMap map[string]negtypes.NetworkEndpointSet, desc string) { | |||
stats := []string{} | |||
stats := []interface{}{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: var stats []interface{}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Thanks for all your work Gaurav. A few more small comments and this should be ready to merge. |
892bf61
to
149e5e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change!
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauravkghildiyal, swetharepakula The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Configure contextual and structured logging for NEG controller
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR is the continuation of kubernetes#1746(contextual logging for components in NEG controller). * Functions will accept a logger object from its caller, so the prefix will be determined based on the caller objects.
This PR incorporates changes suggested by structured logging (KEP) and contextual logging (KEP) into the NEG controller, which improves the overall observability of the logs.
Migration guide that was referred: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md
Changes introduced:
NEGController
Example:
Syncer
,ReadinessReflector
,ClusterL4ILBEndpointsCalculator
etc will also have their component name prefixed.Example:
Example: