-
Notifications
You must be signed in to change notification settings - Fork 4k
grpcutil: improve gRPC logging #103387
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
grpcutil: improve gRPC logging #103387
Conversation
3db58c5 to
3c8f67e
Compare
knz
left a comment
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.
Reviewed 4 of 4 files at r1, 1 of 1 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @aliher1911 and @tbg)
pkg/util/grpcutil/grpc_log.go line 120 at r1 (raw file):
// has a multi-line JSON object in it (but not in any structured way), // so there's really no way to work with it. Best we can do is throw // away the many newlines.
Q: why throw away the newlines? how do they hurt us?
pkg/util/grpcutil/grpc_log.go line 123 at r1 (raw file):
sl := make([]interface{}, 0, len(args)) for _, arg := range args { sl = append(sl, strings.Replace(fmt.Sprint(arg), "\n", "", -1))
nit: replace sequences of multiple newlines with a single space, to avoid two separate words from being concatenated together.
grpc has a `DepthLogger` interface in which the methods called get told about the number of stackframes to skip to get the true caller. This takes a lot of guesswork (which had since gone stale anyway) out of our grpc logger implementation. Now we'll (sort of) reliably get the log lines annotated with the stack frames from which they came. The old interface still needs to be supported, but it's no longer called, so I simplified it down to something that still logs but makes no attempt to get the "correct" caller. Since I was here I couldn't help but also massage the output a bit. Unfortunately gRPC gives us totally unstructured logging, so I can't add redaction or anything of that sort, but I at least removed newlines so that grpc logs are more compact and easier to grep out. I also improved vmodule so that you can opt into *only* gRPC warnings and errors, etc, on a per-file basis (3=INFO, 2=WARNING, 1=ERROR). Epic: none Release note: None squash gRPC logging rework - remove warning output filter - force messages into single line to avoid blobs - rework vmodule logging to make it more useful
It's just noise. `rpc.Context` already logs the connection errors for us. Epic: none Release note: None
It's duplicating info already logged by the rpc.Context. Epic: none Release note: None
3c8f67e to
004b471
Compare
tbg
left a comment
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.
TFTR, appreciate it!
bors r=knz
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @aliher1911 and @knz)
pkg/util/grpcutil/grpc_log.go line 120 at r1 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
Q: why throw away the newlines? how do they hurt us?
I find these log messages pretty irritating to work with since they are difficult to grep out (merge-logs makes it better, but that's not always at hand). The details printed on these lines also barely add any detail but consume a lot of vertical real estate.
|
Build failed: |
|
bors r=knz bors failure is I was able to reproduce this on the merge-base 5af7d05 via
So it isn't introduced in this PR. Still, it's topical to what I'm working on (#99191) so I'll double check what's going on here. This strikes me as completely unexpected in two ways: first, the connection should "just work", second, it shouldn't be unhealthy for >45s, and third, we're not supposed to see "connection unexpectedly re-dialed" pretty much ever, or so I thought. |
|
Build succeeded: |
Extracted from #99191, where I ran a bunch of experiments to make sure the logging around connection failures is clean and helpful.
I did manual testing on the changes in this PR. It's tricky to test vmodule-depth-thingies programmatically and I don't want to spend time building new infra here.
Release note: None
Epic: CRDB-21710