Instrument fork admission timing#295
Merged
Merged
Conversation
yummybomb
approved these changes
Jun 26, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds targeted tracing around fork admission so parallel fanout traces can show where time is spent before restore:
The spans intentionally avoid recording requested instance names.
Testing
go test ./lib/instances -run 'TestForkInstanceFromStandby|TestForkInstanceFromStopped|TestGetInstance|TestListInstances|TestSnapshot' -count=1\n-go test ./lib/instances -run 'TestSaveForkMetadataSerializesNameAdmission|TestForkInstanceRejectsDuplicateNameForNonNetworkedSource|TestForkInstanceFromStandbyCancelsCompressionJobAndCopiesRawMemory|TestForkSnapshotFromCompressedSourceCopiesRawMemory' -count=1\n-go test ./lib/network -count=1\n\nNote: I did not run the fullgo test ./lib/instancespackage to completion locally; it entered longer integration-style tests, so I used the focused fork/query coverage above for this instrumentation-only patch.Note
Low Risk
Observability-only: spans and context threading on existing fork admission paths, with no intended change to locking or name-check semantics.
Overview
Adds OpenTelemetry spans along fork admission so parallel fanout traces can show time spent before restore, without recording requested instance names.
Metadata name checks now take
contextand a static caller label (fork_precheck,fork_admission,snapshot_create). Exact-name scans emit spans with metadata file counts, how many files were scanned, and match outcome.saveForkMetadatais split into spans for the overall save, mutex wait, and hold while admission re-checks names and persists metadata; errors are wired so spans finish with the returned error.Fork/snapshot guest copy and
prepareForkWithAliasReadLockgain parent spans plusstartLifecycleStepchildren for snapshot memory readiness and directory clone work (including deferred Firecracker memory paths).Reviewed by Cursor Bugbot for commit c8b9a0f. Bugbot is set up for automated code reviews on this repo. Configure here.