-
Notifications
You must be signed in to change notification settings - Fork 12
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,grpc: simpler gRPC logger for server #348
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jchappelow
commented
Oct 13, 2023
pkg/grpc/server/logging.go
Outdated
func codeToLevel(code codes.Code) log.Level { | ||
switch code { | ||
case codes.OK: | ||
return log.InfoLevel // log.DebugLevel |
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 should be Debug level at some point. Virtually every node will not log every successful RPC, although we are early and this is still helpful.
jchappelow
commented
Oct 13, 2023
jchappelow
force-pushed
the
simpler-grpc-logger
branch
from
October 13, 2023 19:18
0a0a867
to
0374aca
Compare
jchappelow
changed the title
pkg/log,grpc: simpler gRPC logger for server
log,grpc: simpler gRPC logger for server
Oct 13, 2023
brennanjl
approved these changes
Oct 16, 2023
brennanjl
pushed a commit
that referenced
this pull request
Feb 26, 2024
* pkg/log,grpc: simpler gRPC logger for server * include client address
brennanjl
pushed a commit
that referenced
this pull request
Feb 26, 2024
* pkg/log,grpc: simpler gRPC logger for server * include client address
jchappelow
added a commit
that referenced
this pull request
Feb 26, 2024
* pkg/log,grpc: simpler gRPC logger for server * include client address
brennanjl
pushed a commit
that referenced
this pull request
Feb 26, 2024
* pkg/log,grpc: simpler gRPC logger for server * include client address
brennanjl
pushed a commit
that referenced
this pull request
Feb 26, 2024
* pkg/log,grpc: simpler gRPC logger for server * include client address
brennanjl
pushed a commit
that referenced
this pull request
Feb 26, 2024
* pkg/log,grpc: simpler gRPC logger for server * include client address
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Spinning this out of some ongoing work with the gRPC service because the server's RPC logging is excessively verbose.
This replaces the interceptor logger with a new
SimpleInterceptorLogger
that logs with more sensible information, severity levels, and only on RPC completion rather than both start/stop of request.Before
{"level":"info","ts":1697148715.6290593,"logger":"kwild.grpc-server","msg":"started call","protocol":"grpc","grpc.component":"server","grpc.service":"tx.TxService","grpc.method":"GetSchema","grpc.method_type":"unary","peer.address":"127.0.0.1:34840","grpc.start_time":"2023-10-12T17:11:55-05:00","grpc.time_ms":"0.02"}
{"level":"info","ts":1697148715.6291308,"logger":"kwild.grpc-server","msg":"finished call","protocol":"grpc","grpc.component":"server","grpc.service":"tx.TxService","grpc.method":"GetSchema","grpc.method_type":"unary","peer.address":"127.0.0.1:34840","grpc.start_time":"2023-10-12T17:11:55-05:00","grpc.code":"OK","grpc.time_ms":"0.097"}
After
{"level":"info","ts":1697152104.4972465,"logger":"kwild.grpc-server","msg":"call success","method":"tx.TxService/ListDatabases","elapsed":"0.052ms","code":"OK"}