Skip to content

Report when buffered events are flushed to a late listener#324044

Draft
dmitrivMS wants to merge 1 commit into
mainfrom
dev/dmitriv/event-buffer-telemetry
Draft

Report when buffered events are flushed to a late listener#324044
dmitrivMS wants to merge 1 commit into
mainfrom
dev/dmitriv/event-buffer-telemetry

Conversation

@dmitrivMS

Copy link
Copy Markdown
Contributor

Ref #234393

This is to investigate what events take actually use buffer today.

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings July 2, 2026 11:51
@dmitrivMS dmitrivMS added the freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues label Jul 2, 2026
@dmitrivMS dmitrivMS requested a review from alexdima July 2, 2026 11:51
@dmitrivMS dmitrivMS self-assigned this Jul 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 diagnostic telemetry to identify when ProxyChannel.fromService IPC event buffering is actually used (i.e., buffered events get flushed to a late-attaching listener). It extends Event.buffer with an optional callback to report buffered event counts when the first listener attaches, and wires that into ProxyChannel plus key processes (electron main, shared process, agent host).

Changes:

  • Extend Event.buffer to optionally report the buffered event count when the first listener attaches.
  • Add a ProxyChannel process-wide buffer-usage reporter hook and emit telemetry (ipc.proxyChannelBufferUsed) when buffered events are delivered.
  • Install this diagnostic telemetry reporter in electron-main, shared process, and agent host entry points.
Show a summary per file
File Description
src/vs/platform/telemetry/common/telemetryUtils.ts Adds installer that hooks ProxyChannel buffering and logs telemetry when buffering is used.
src/vs/platform/agentHost/node/agentHostMain.ts Installs the proxy-channel buffer usage telemetry in the agent host process.
src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts Installs the proxy-channel buffer usage telemetry in the shared process.
src/vs/code/electron-main/app.ts Installs the proxy-channel buffer usage telemetry in the electron main process IPC channel init.
src/vs/base/test/common/event.test.ts Adds unit tests validating the new “report buffered count on first listener” behavior.
src/vs/base/parts/ipc/common/ipc.ts Introduces a global ProxyChannel.setBufferUsageReporter and wires it into buffered IPC events.
src/vs/base/common/event.ts Extends Event.buffer signature + implementation to optionally report buffered count when first listener attaches.

Review details

  • Files reviewed: 7/7 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment on lines +6 to +8
import { IDisposable, toDisposable } from '../../../base/common/lifecycle.js';
import { cloneAndChange, safeStringify } from '../../../base/common/objects.js';
import { ProxyChannel } from '../../../base/parts/ipc/common/ipc.js';
Comment on lines +38 to +40
export function installProxyChannelBufferUsageTelemetry(telemetryService: ITelemetryService): IDisposable {
const reported = new Set<string>();
ProxyChannel.setBufferUsageReporter((serviceName, eventName, bufferedCount) => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants