-
Notifications
You must be signed in to change notification settings - Fork 67
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
Log filtering framework client #608
Conversation
@@ -158,8 +158,6 @@ func TestCallTChannelSuccessfulRequestOKResponse(t *testing.T) { | |||
"hostname", | |||
"pid", | |||
"timestamp-finished", | |||
"Client-Req-Header-x-request-uuid", |
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.
Why are these fields deleted?
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.
The code to add "Client-Req-Header" was removed from here: https://github.com/uber/zanzibar/pull/608/files/4728e886495b2d2fa9f1d0a92a3d83b0c92947a9#diff-63b43474c6820d3db553746e13b0e82fL92
Hence, these logs will not be generated anymore.
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.
I don't see any filter added to remove those from the logs, what happened here is that endpoint and client have the same header keys, and putting them on the context has an overwrite effect. We need the prefix to differentiate between those.
… and endpoint template fixes
runtime/tchannel_outbound_call.go
Outdated
var logFields []zap.Field | ||
if c.client != nil && c.client.contextExtractor != nil { | ||
headers := map[string]string{} | ||
for k, v := range c.reqHeaders { |
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.
This only includes request headers, what about response headers?
Also we need the prefix to differentiate the header keys between client and endpoint
@@ -158,8 +158,6 @@ func TestCallTChannelSuccessfulRequestOKResponse(t *testing.T) { | |||
"hostname", | |||
"pid", | |||
"timestamp-finished", | |||
"Client-Req-Header-x-request-uuid", |
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.
I don't see any filter added to remove those from the logs, what happened here is that endpoint and client have the same header keys, and putting them on the context has an overwrite effect. We need the prefix to differentiate between those.
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.
Almost there, just some test change that we should not do.
@@ -62,14 +62,9 @@ func getRequestTags(ctx context.Context) map[string]string { | |||
func getRequestFields(ctx context.Context) []zap.Field { | |||
var fields []zap.Field | |||
headers := zanzibar.GetEndpointRequestHeadersFromCtx(ctx) | |||
uuid, ok := headers["X-Uuid"] |
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.
We should not change this section, we deliberately avoided to have token as log fields here.
test/endpoints/tchannel/baz/baz_simpleservice_method_call_test.go
Outdated
Show resolved
Hide resolved
"Deviceversion": "1.0", | ||
"Device": "ios", | ||
"Regionname": "sf", | ||
"x-token": "token", |
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.
Token is still logged?
There was no mechanism to filter logs in the client. This adds a new framework in client using ContextExtractor to filter logs.