Skip to content

Add telemetry events to mount initialization phases#2033

Open
tyrielv wants to merge 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/mount-phase-telemetry
Open

Add telemetry events to mount initialization phases#2033
tyrielv wants to merge 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/mount-phase-telemetry

Conversation

@tyrielv

@tyrielv tyrielv commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Problem

When the GVFS mount process hangs during initialization, there is NO telemetry in Application Insights between the VFS.EnlistmentInfo event and VFS.Mount 'Virtual repo is ready'. This makes it impossible to diagnose which phase is stuck from server-side telemetry.

A user experienced a mount that took 136 seconds to initialize (normally <1s), and we could only see a 60-second gap in telemetry with no events. The mount was stuck in the auth/network validation phase.

Solution

Add Keywords.Telemetry events at each phase transition during MountWithLockAcquired. Each event uses a consistent MountPhase event name with a Phase field and an ElapsedMs field measuring time since mount start.

New MountPhase events

Phase When
ParallelMountStarted Parallel auth + local validation begins
NetworkValidationComplete Auth + /gvfs/config query done
LocalValidationComplete Git/hooks/fs validation + config done
ParallelMountComplete Both parallel tasks finished
CacheServerResolved Cache server URL resolved
LocalCacheHealthy Local object cache validated
ContextCreated GVFSContext initialized
HooksUpdated Hook binaries installed (or skipped for worktrees)
VirtualizationStarting About to start ProjFS callbacks

The existing VFS.Mount 'Virtual repo is ready' event serves as the final phase.

Analysis: Network timeout budget

RetryConfig defaults: 6 retries x 30s timeout = 210s worst case for TryInitializeAndQueryGVFSConfig. When auth is expired or network is unreachable, the mount can block for up to 210s in the network task with no telemetry — these new events make that gap visible and pinpoint exactly which phase is stuck.

Testing

  • Builds successfully (dotnet build GVFS.Mount.csproj)
  • Events are informational-level with Keywords.Telemetry so they flow to Application Insights
  • No behavioral changes — purely additive observability

Emit Keywords.Telemetry events at each phase transition during mount
so that slow or hung mounts can be diagnosed from server-side telemetry.
Previously, there was a telemetry gap between VFS.EnlistmentInfo and
VFS.Mount 'Virtual repo is ready' — if any intermediate phase stalled,
no Application Insights events were recorded.

New MountPhase events with elapsed-since-mount-start timestamps:
- ParallelMountStarted: parallel auth+local validation begins
- NetworkValidationComplete: auth + /gvfs/config query done (duration)
- LocalValidationComplete: git/hooks/fs validation + config done (duration)
- ParallelMountComplete: both parallel tasks finished
- CacheServerResolved: cache server URL resolved
- LocalCacheHealthy: local object cache validated
- ContextCreated: GVFSContext initialized
- HooksUpdated: hook binaries installed (or skipped for worktrees)
- VirtualizationStarting: about to start ProjFS callbacks

Note: RetryConfig defaults are 6 retries x 30s timeout = 210s worst case
for the network task. When auth is expired/stuck, the mount can block for
up to 210s in TryInitializeAndQueryGVFSConfig with no telemetry — these
new events make that visible.

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@tyrielv tyrielv force-pushed the tyrielv/mount-phase-telemetry branch from 47f7fd6 to 403dc23 Compare June 19, 2026 00:08
@tyrielv tyrielv marked this pull request as ready for review June 19, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant