This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Repository navigation
Runtime tracing, flight recording - #3627
Closed
Jake Bailey (jakebailey) wants to merge 13 commits into
Closed
Jake Bailey (jakebailey) wants to merge 13 commits into
Jake Bailey (jakebailey) wants to merge 13 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Go runtime/trace integration (including a flight recorder) to tsgo, and wires capture/control into the LSP + the preview VS Code extension to make runtime tracing accessible similarly to existing pprof tooling.
Changes:
- Introduces
internal/runtimetraceto manage process-lifetime runtime tracing and flight-recorder snapshots (env-driven + SIGUSR1 on Unix). - Plumbs
context.Contextthrough checker/program APIs and adds trace regions/log events across compiler, parser, resolver, project system, and LSP request handling. - Adds new LSP custom requests + VS Code extension commands to start/snapshot/stop the flight recorder.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/transformers/tstransforms/importelision_test.go | Updates test program stub + checker creation to pass context.Context. |
| internal/testrunner/compiler_runner.go | Passes t.Context() into ForEachCheckerParallel for tracing-friendly APIs. |
| internal/runtimetrace/runtimetrace.go | New session management for runtime trace + flight recorder via env vars, snapshot-on-stop, Unix signal hook. |
| internal/runtimetrace/recorder.go | New FlightRecorder wrapper around runtime/trace flight recorder APIs (start/snapshot/stop). |
| internal/runtimetrace/api.go | New helpers for trace regions/tasks and safe/unsafe logging conventions. |
| internal/runtimetrace/signal_unix.go | Unix SIGUSR1 handler to trigger a flight snapshot. |
| internal/runtimetrace/signal_other.go | Non-Unix no-op signal handler implementation. |
| internal/project/snapshot.go | Adds trace region around snapshot cloning. |
| internal/project/session.go | Adds trace region around snapshot updates. |
| internal/project/project.go | Adapts program binding call to new context-aware BindSourceFiles. |
| internal/project/checkerpool.go | Threads ctx into checker creation in the project checker pool. |
| internal/parser/parser.go | Adds trace region + trace log events to parsing entrypoint. |
| internal/module/resolver.go | Adds trace region + trace log events to module resolution entrypoint. |
| internal/lsp/server.go | Adds per-request trace tasks/logging and new handlers for flight recorder control. |
| internal/lsp/lsproto/lsp_generated.go | Generated protocol additions for flight recorder requests/params/results. |
| internal/lsp/lsproto/_generate/generate.mts | Adds generator specs for flight recorder protocol structures/requests. |
| internal/ls/autoimport/util.go | Makes checker pool acquisition context-aware and threads ctx into checker creation. |
| internal/ls/autoimport/registry.go | Updates checker creation/usage to pass ctx and handle canceled acquisition. |
| internal/ls/autoimport/aliasresolver.go | Updates BindSourceFiles signature for ctx-aware checker.Program. |
| internal/execute/tsc.go | Adds trace regions around compilation entrypoints. |
| internal/compiler/program.go | Adds trace regions/logging in binding/diagnostics/emit, and threads ctx through checker pool APIs. |
| internal/compiler/fileloader.go | Adds trace region around program file processing. |
| internal/compiler/emitter.go | Adds trace region/logging for emit and adds additional transformer regions. |
| internal/compiler/checkerpool.go | Threads ctx into checker creation and adds trace region/logging around checker pool init. |
| internal/checker/checker_test.go | Updates tests/bench to new ctx-aware BindSourceFiles/NewChecker. |
| internal/checker/checker.go | Makes Program.BindSourceFiles ctx-aware and adds trace regions/logging in checker creation + file checking. |
| cmd/tsgo/main.go | Starts/stops runtime tracing session for the tsgo process lifetime. |
| _extension/src/session.ts | Adds VS Code commands for start/snapshot/stop flight recorder and context key wiring. |
| _extension/src/client.ts | Adds client methods to call new custom LSP flight recorder requests. |
| _extension/package.json | Registers new extension commands and enablement conditions. |
| .golangci.yml | Updates depguard rules to forbid direct runtime/trace usage outside internal/runtimetrace and adjusts linter exclusions. |
# Conflicts: # .golangci.yml # internal/lsp/server.go # internal/project/checkerpool.go
Member
Author
|
This is not going to happen before the repo move, closing an will do another day. |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This adds Go
runtime/tracesupport, including flight recording. Traces are integrated into the VS Code extension, similarly to pprof profiling.I've added trace points in various places, and plumbed context around a bit.