Instrument fork admission timing#295
Open
sjmiller609 wants to merge 1 commit into
Open
Conversation
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
Instrumentation-only: context propagation and tracing around existing fork admission logic with no intended behavior change.
Overview
Adds OpenTelemetry spans on fork admission paths so parallel fanout traces can show where time goes before restore, without recording requested instance names on spans.
Metadata name checks now take
contextand a static caller label (fork_precheck,fork_admission,snapshot_create).findInstanceMetadataByExactNameandinstanceNameExistsemit spans with metadata file counts, files scanned, and match outcome.saveForkMetadatais traced end-to-end: overall save, lock wait untilforkMetadataMuis acquired, and lock hold while admission re-checks names and persists; work under the mutex uses the hold span’s context.Fork/snapshot guest copy paths gain spans for
prepareForkWithAliasReadLock, plus nested lifecycle steps for snapshot memory readiness and directory clone on instance fork and snapshot fork copy helpers.Reviewed by Cursor Bugbot for commit 274c265. Bugbot is set up for automated code reviews on this repo. Configure here.