Collect telemetry on recovered notification panics and stderr on unrecovered panics#3824
Conversation
There was a problem hiding this comment.
Pull request overview
Adds missing crash telemetry coverage for the TypeScript-Go language server, both for recovered panics (now including notifications) and for unrecovered crashes (now including recent stderr content from the VS Code output channel).
Changes:
- Always emit
TelemetryEventInfofor recovered panics, regardless of whether the LSP message is a request or notification. - Capture and report the last buffered stderr output when the language server connection closes unexpectedly.
- Extend the extension telemetry typing to include
lastStderrfor thelanguageServer.connectionClosedevent.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| internal/lsp/server.go | Moves panic telemetry emission outside the request-only branch so notifications also send crash telemetry. |
| _extension/src/client.ts | Hooks output-channel error output to buffer stderr and includes it in languageServer.connectionClosed telemetry. |
| _extension/src/telemetryReporting.ts | Updates telemetry event typing to include lastStderr for connection-closed events. |
|
I'm not sure we can send the stderr raw; is there specific text we think we are going to find that we can look for? |
|
That is not what @DanielRosenwasser told me in chat, unless I misunderstood |
|
If we can pretty confidently validate that we have a stack trace, we can do some client-side sanitization like we used to. We have some stuff on the endpoint to get rid of PII just in case. |
|
I don't know what kind of sanitization would be safe; for stack traces we know the exact format and can parse it to remove info. I don't know off the top of my head what's possible to go over stderr. We fall back to stderr when the client isn't available for logging yet, and I don't know what happens if say, the process OOMs and logs some info, or otherwise hits a big crash? |
|
7f439ae made it so we only process lines between |
|
right, but I'm more thinking about if there's a panic followed by more text that some other goroutine is logging, interleaved. Maybe it just works? |
|
The sanitizer redacts lines that don't match a recognized pattern. |


Adds crash telemetry in two cases we were missing:
languageServer.connectionClosed, but lacked any error message. We now capture the last 40 lines of STDERR from the output channel and include that in the event.