Report when buffered events are flushed to a late listener#324044
Draft
dmitrivMS wants to merge 1 commit into
Draft
Report when buffered events are flushed to a late listener#324044dmitrivMS wants to merge 1 commit into
dmitrivMS wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
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.bufferto optionally report the buffered event count when the first listener attaches. - Add a
ProxyChannelprocess-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) => { |
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.
Ref #234393
This is to investigate what events take actually use buffer today.