chat: add startup telemetry for live chat model counts#307678
Merged
roblourens merged 2 commits intomainfrom Apr 3, 2026
Merged
chat: add startup telemetry for live chat model counts#307678roblourens merged 2 commits intomainfrom
roblourens merged 2 commits intomainfrom
Conversation
After reviving sessions with pending edits at startup, log telemetry with the number of live chat models, how many are open in widgets, how many are background-only, and how many are kept alive solely because they have unaccepted edits. - Expose whenSessionsRevived promise on IChatService - Add browser-layer contribution that awaits revival + uses IChatWidgetService to classify models without hard-coded strings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a startup telemetry event that reports counts of live chat models after pending-edit sessions are revived, enabling insight into how many models are visible in widgets vs kept alive in the background.
Changes:
- Exposed
IChatService.whenSessionsRevivedso callers can await completion of startup revival of sessions with pending edits. - Implemented
whenSessionsRevivedinChatService(and test mock) and wired it to the existingreviveSessionsWithEdits()startup task. - Added an
AfterRestoredworkbench contribution that logschat.modelsAtStartuptelemetry by classifying models usingIChatWidgetService.getWidgetBySessionResource(...).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts | Updates test mock to implement the new whenSessionsRevived API surface. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Stores the session-revival promise on the service so consumers can await it. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Adds whenSessionsRevived to IChatService. |
| src/vs/workbench/contrib/chat/browser/chat.contribution.ts | Adds and registers an AfterRestored telemetry contribution that logs model-count telemetry at startup. |
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts
Outdated
Show resolved
Hide resolved
…check - Wrap reviveSessionsWithEdits with .catch() to avoid unhandled rejection - Mark logTelemetry() as void fire-and-forget - Check referenceCount === 1 for modelsKeptAliveOnlyForEdits Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bhavyaus
approved these changes
Apr 3, 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.
After reviving sessions with pending edits at startup, fire a
chat.modelsAtStartuptelemetry event with:IChatWidgetService.getWidgetBySessionResource)Implementation details
whenSessionsRevivedpromise onIChatServiceso consumers can await session revival completionWorkbenchPhase.AfterRestoredcontribution, so it runs after widgets have restored and after revival completesIChatWidgetService.getWidgetBySessionResource()to classify models (no hard-coded holder strings)