feat(telemetry): instrument auth and workspace state#948
Open
EhabY wants to merge 3 commits into
Open
Conversation
- workspace.ts: inline single-use transition helpers, unify on the spread idiom for optional `observedDurationMs`, move `performance.now()` below the dedup early-return, drop the no-op `() => fn()` wrapper in `traceUpdateTriggered`, and make `INITIAL_STATE` private. - auth.ts: replace the `T extends LoginPromptResult` constraint with a `LoginPromptTracer` exposing `markAborted()`, matching the `RemoteSetupTracer` pattern. Callers now drive abort signaling, so telemetry no longer depends on `LoginResult`'s shape. - loginCoordinator: call `tracer.markAborted()` on `!result.success`.
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
remote.setup.workspace_readyfor full readiness timingCloses #906.
Validation
pnpm test:extension ./test/unit/oauth/sessionManager.test.ts ./test/unit/api/authInterceptor.test.ts ./test/unit/login/loginCoordinator.test.ts ./test/unit/remote/workspaceStateMachine.test.ts ./test/unit/workspace/workspaceMonitor.test.tspnpm typecheckpnpm lintpnpm format:checkpnpm test:extensionImplementation plan and decisions
Confirmed adjustment:
workspace.start/workspace.stopevents with transition telemetry that better matches the current architecture:workspace.state_transitionedworkspace.agent.state_transitionedworkspace.update.triggeredauth.token_refresh,auth.intercept_401,auth.login_prompt)Implemented:
src/instrumentation/auth.tsandsrc/instrumentation/workspace.ts.TelemetryReporterinjection.WorkspaceMonitorand selected-agent transitions fromWorkspaceStateMachine.observedDurationMsbetween observed transitions where available.TestSinkcoverage for auth events, update trigger events, and workspace/agent transition events.Generated by Coder Agents.