Skip to content

Add telemetry to keep an eye on the number of network requests we're sending#4321

Merged
lramos15 merged 6 commits intomainfrom
lramos15/compatible-cephalopod
Mar 10, 2026
Merged

Add telemetry to keep an eye on the number of network requests we're sending#4321
lramos15 merged 6 commits intomainfrom
lramos15/compatible-cephalopod

Conversation

@lramos15
Copy link
Member

@lramos15 lramos15 commented Mar 10, 2026

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds telemetry instrumentation to track the number and latency of network requests made by the extension. It introduces a mandatory callSite property on FetchOptions to identify where each fetch request originates, fires a FetchTelemetryEvent after each fetch completion (success or failure), and subscribes to those events in the TelemetryService to send fetchTelemetry events — restricted to Insiders (pre-release) builds only.

Changes:

  • Adds callSite as a required field on FetchOptions, a FetchTelemetryEvent interface, and an onDidCompleteFetch event to IFetcherService, with the event emitted from FetcherService.fetch() on both success and error paths.
  • Updates all existing fetch() call sites across the codebase (30+ files) to include a descriptive callSite string, and adds a NO_FETCH_TELEMETRY sentinel to suppress telemetry on the telemetry service's own fetch calls.
  • Subscribes to the new event in TelemetryService (Insiders only) to emit fetchTelemetry telemetry events with callSite, latencyMs, and statusCode.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/platform/networking/common/fetcherService.ts Adds callSite to FetchOptions, FetchTelemetryEvent interface, onDidCompleteFetch event to IFetcherService, NO_FETCH_TELEMETRY constant, and safeGetHostname helper
src/platform/networking/vscode-node/fetcherServiceImpl.ts Fires onDidCompleteFetch from fetch() on success/error, with latency measurement
src/platform/telemetry/vscode-node/telemetryServiceImpl.ts Subscribes to fetch telemetry events (Insiders only) and sends MSFT telemetry; uses NO_FETCH_TELEMETRY for its own fetch calls
src/extension/extension/vscode-node/services.ts **Contains `if (true
src/extension/completions-core/vscode-node/lib/src/networking.ts Adds callSite to CompletionsFetcher.fetch() and postRequest()
src/platform/networking/common/networking.ts Adds dynamic callSite: network-request-${intent}
src/platform/github/common/githubAPI.ts Adds callSite to GitHub REST, GraphQL, and sessions API calls
src/platform/github/common/githubService.ts Adds callSite to GitHub status check
src/platform/authentication/node/copilotTokenManager.ts Adds callSite to token fetch calls
src/extension/byok/vscode-node/*.ts Adds callSite to BYOK/Ollama provider fetch calls
src/extension/mcp/vscode-node/*.ts Adds callSite to NuGet, npm, PyPI, Docker registry calls
src/extension/log/vscode-node/loggingActions.ts Adds callSite to diagnostics probe fetch calls
src/extension/inlineEdits/vscode-node/components/nesFeedbackSubmitter.ts Adds callSite to NES feedback GitHub API calls
src/extension/prompt/node/chatMLFetcher.ts Adds callSite to CAPI ping
src/platform/snippy/common/snippyFetcher.ts Adds callSite to snippy match
src/platform/nesFetch/node/completionsFetchServiceImpl.ts Adds callSite to NES completions
src/platform/proxyModels/node/proxyModelsService.ts Adds callSite to proxy models
src/platform/releaseNotes/vscode/releaseNotesServiceImpl.ts Adds callSite to release notes fetch
src/platform/embeddings/common/embeddingsIndex.ts Adds callSite to embeddings cache fetches
src/platform/endpoint/node/routerDecisionFetcher.ts Adds callSite to router decision
src/extension/completions-core/vscode-node/lib/src/snippy/*.ts Adds callSite to snippy network and ping
Various test files Updates mock IFetcherService implementations with onDidCompleteFetch and callSite in test fetch calls

@lramos15 lramos15 requested a review from Copilot March 10, 2026 15:35
@lramos15 lramos15 marked this pull request as ready for review March 10, 2026 15:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 10, 2026
protected async getFileContentWithToken(owner: string, repo: string, ref: string, path: string, token: string): Promise<string> {
const route = `repos/${owner}/${repo}/contents/${path}?ref=${encodeURIComponent(ref)}`;
const response = await makeGitHubAPIRequest(this._fetcherService, this._logService, this._telemetryService, this._capiClientService.dotcomAPIURL, route, 'GET', token, undefined);
const response = await makeGitHubAPIRequest(this._fetcherService, this._logService, this._telemetryService, this._capiClientService.dotcomAPIURL, route, 'GET', token, undefined, undefined, undefined, undefined, undefined, undefined, 'github-rest-get-file-content');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

@lramos15 lramos15 added this pull request to the merge queue Mar 10, 2026
Merged via the queue into main with commit 99d97ff Mar 10, 2026
23 checks passed
@lramos15 lramos15 deleted the lramos15/compatible-cephalopod branch March 10, 2026 17:58
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.

3 participants