-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add log fields metadata to gRPC calls #359
Conversation
|
||
return clientStream, err | ||
} | ||
} | ||
|
||
func newServerRequestLogger(l log.Logger, fullMethod string) log.Logger { | ||
func newServerRequestLogger(ctx context.Context, fullMethod string) log.Logger { |
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.
duplicate of util/grpchelper/logger.go:104-115 (dupl)
If you have feedback about this comment, please, tell us.
} | ||
|
||
func newClientRequestLogger(l log.Logger, fullMethod string) log.Logger { | ||
func newClientRequestLogger(ctx context.Context, fullMethod string) log.Logger { |
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.
duplicate of util/grpchelper/logger.go:91-102 (dupl)
If you have feedback about this comment, please, tell us.
@@ -0,0 +1,90 @@ | |||
package grpchelper |
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.
file is not goimported (goimports)
If you have feedback about this comment, please, tell us.
0ba8f7f
to
942d9b2
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.
👍 we will need that new method in go-log for #357 too
I just noticed that CI is green even without |
Yes, I was thinking I would wait for support in go-log. And then add some new greps to |
942d9b2
to
e366972
Compare
Pushed new commits on top of #375, with tests. We still need to decide if we want to keep the log fields in the metadata, or as grpc fields. But at least this branch is now up to date and ready to be merged, or be adapted. |
Sorry for delaying this, you can do as you want, my only concert was not passing an instance of a logger in a context. |
Signed-off-by: Carlos Martín <[email protected]>
Signed-off-by: Carlos Martín <[email protected]>
Signed-off-by: Carlos Martín <[email protected]>
e366972
to
6ba788a
Compare
WIP because it needs support from go-log, src-d/go-log#9. But I'd like to get feedback.
Fix #248.
The changes in this PR depend on fixing #357 to be really useful. But the issues are independent, the other bug can be fixed after this one is merged. In the examples below you can see the analyzer and event-id fields.
Changes in this PR include:
Improvements to already existing interceptors. Now they use a log from context, instead of the default one.
Before
After:
.
New interceptors to pass log fields in the gRPC metadata, encoded as JSON. Using these interceptors the logs fields go from
lookoutd
->analyzer
as client/server, but also fromanalyzer
->lookoutd
.Before:
After:
If an analyzer does not use the interceptors the log fields are not passed around, but it will not cause any problems. Since the metadata is JSON, it should be easy to add this functionality to the python SDK.