Browser: Playwright API metrics#316473
Draft
jruales wants to merge 10 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds telemetry for the Integrated Browser run_playwright_code tool to capture Playwright page API usage, success, deferral, duration, and code-size metrics.
Changes:
- Injects telemetry into
RunPlaywrightCodeTooland logs completed/failed invocations. - Adds
pageMethodsCalledto Playwright invocation results. - Wraps Playwright
pagewith a proxy to count method calls and adds a telemetry event helper.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/browserView/electron-browser/tools/runPlaywrightCodeTool.ts |
Logs telemetry for Playwright code tool invocations. |
src/vs/platform/browserView/node/playwrightService.ts |
Tracks Playwright page API calls via proxy and includes counts in invocation results. |
src/vs/platform/browserView/common/playwrightService.ts |
Extends invoke result shape with page method call counts. |
src/vs/platform/browserView/common/browserViewTelemetry.ts |
Defines and emits the new Playwright code telemetry event. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/platform/browserView/node/playwrightService.ts:722
- Recursively creating a fresh proxy on every object-property read changes Playwright object identity semantics (for example,
page.keyboard === page.keyboardbecomes false). Code that caches, compares, or uses nested API objects as map keys can behave differently under this proxy; cache proxies per target/prefix so repeated property reads return the same wrapper.
if (value !== null && typeof value === 'object') {
return createPageApiProxy(value as object, methodCalls, `${prefix}${prop}.`, depth + 1);
- Files reviewed: 4/4 changed files
- Comments generated: 4
kycutler
reviewed
Jun 1, 2026
| const entries = Object.entries(pageMethodsCalled); | ||
| const total = entries.reduce((sum, [, count]) => sum + count, 0); | ||
| this.telemetryService.publicLog2<RunPlaywrightCodeEvent, RunPlaywrightCodeClassification>( | ||
| 'integratedBrowser.tools.runPlaywrightCode.completed', |
Contributor
There was a problem hiding this comment.
Wonder if we should log this from the shared service instead -- so if a call is deferred but the agent never queries for the result, it still gets logged eventually
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.
No description provided.