OmniSharp / OmniSharp/csharp-language-server-protocol

[info request] traceparent and general logging question

Open
#549 11 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
638
Forks
109
Avg merge
1m
Merged PRs (30d)
2

Description

I've got a question about logging in O#. For context, I work on the Visual Studio web tooling team, and we are using O# for html and css language server support in VS. We run the language server in it's own process as opposed to running inside the VS process. Everything works pretty dandy so far. Kudos to the work you’ve done!

To clarify what I'm trying to do, I've called ConfigureLogging and added my ILoggerProvider to the builder.Services instead of using AddLanguageProtocolLogging. My ILoggerProvider doesn't send out a window/logMessage notification, but rather writes out to a .svclog file (via LogHub) that will be able to be collected by VS and opened with other log files from the VS process which can link the activity IDs.

The difficulty I’m experiencing is trying to get logging inside this process to understand the "traceparent" activity id that VS sends over in the json payload. In VS, setting TraceSource.ActivityID is handled by this code in StreamJsonRpc, which makes it so we can associate activity ids from the two processes. However, it appears O# has it’s own RPC infrastructure, and doesn’t handle this on our behalf. I then tried looking into whether there were any hooks that I could use to inspect the JToken during the routing and gather this information before it’s converted into the appropriate args, but I haven’t been able to find any.

I’m hoping I’m misunderstanding logging inside O# and there is a way to have it understand the trace parent activity id from the client process. Any suggestions would be greatly appreciated!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ConfigureLogging and the builder.Services registration, then trace how the RPC routing handles the JSON payload and its traceparent value. Compare this with AddLanguageProtocolLogging and the linked StreamJsonRpc correlation strategy; done means establishing whether the custom logging provider can correlate activity IDs across the two processes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.