This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add index server request logging
ClosedPublic

Authored by sammccall on Nov 2 2020, 3:45 PM.

Details

Summary
  • Add verbose logging of payloads
  • Add public logging of request summaries
  • fix non-logging of messages in request scopes (oops!)
  • add test for public/non-public logging, extending pipeline_helper a bit.

We've accumulated quite a lot of duplication in the request handlers by now.
I should factor that out, but not in this patch...

Diff Detail

Event Timeline

sammccall created this revision.Nov 2 2020, 3:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2020, 3:45 PM
sammccall requested review of this revision.Nov 2 2020, 3:45 PM
kbobyrev accepted this revision.Nov 2 2020, 10:52 PM
kbobyrev added inline comments.
clang-tools-extra/clangd/index/remote/server/Server.cpp
257

nit: everything is public by default since it's struct, right? did you mean to put &M behind private?

clang-tools-extra/clangd/test/remote-index/pipeline_helper.py
25

nit: PEP is against having <2 lines between functions :(

32

Why do we need wb here instead of w? I know that subprocess.Popen writes binary data but since we're writing actual text to file maybe we could convert to non-binary?

89

this was pipeline_helper.py intended for pipeline.test, maybe we'll use it more so makes sense to rename it to just helper.py or somethting.

This revision is now accepted and ready to land.Nov 2 2020, 10:52 PM

I wish there was an easy way to check redacted error logs too :/

clang-tools-extra/clangd/index/remote/server/Server.cpp
332

feels like this one, and the one below are residues?

clang-tools-extra/clangd/test/remote-index/public-log.test
3

nit: use %/S to not mix forward and backslashes.

4

not sure if it is any easier, but it might make sense to just pass anything after -- to server, rather than explicitly mentioning --server-arg before each one. I suppose we can also rename the script to server_request_helper ?

This won't work if we decide to pass arbitrary client flags too though.

7

can you also add a check for TextProto printing ? I believe descriptor names should be enough.

ArcsinX added a subscriber: ArcsinX.Nov 3 2020, 3:22 AM
ArcsinX added inline comments.
clang-tools-extra/clangd/test/remote-index/pipeline_helper.py
45

this breaks remote-index/pipeline.test test for me:

TypeError: can only concatenate list (not "NoneType") to list
clang-tools-extra/clangd/test/remote-index/public-log.test
6

Maybe we can use --input-file option of FileCheck instead of < (the same for the next line)

sammccall marked 5 inline comments as done.Nov 11 2020, 2:57 PM

Oops, took a while to get back to this.
Planning to land this with some style unaddressed (%/S, --input-file) but please do LMK if they're important and I'll fix.

clang-tools-extra/clangd/test/remote-index/pipeline_helper.py
32

we're just redirecting data from one stream to another, I don't think there's any reason to do character decoding+encoding on the way...

89

Agree - can do that as a followup.

clang-tools-extra/clangd/test/remote-index/public-log.test
3

Why do we want to avoid mixing them?
(This is copied from the other test which uses %S)

4

Yeah, there aren't a lot of these so i'd like it to be super-explicit for now. Happy to change this if we end up with lots of tests passing various server args (and few client args)

6

Why would this be preferred? (< is roughly 5x more common in llvm/test and clang/test - neither is used significantly in clang-tools-extra)

This revision was landed with ongoing or failed builds.Nov 11 2020, 2:58 PM
This revision was automatically updated to reflect the committed changes.