Add aggregate image metadata to Copilot telemetry#317785
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a shared helper to compute non-restricted, aggregate image metadata and attaches those measurements to Copilot telemetry for chat responses and Auto mode router events, enabling analysis of vision usage without sending image content.
Changes:
- Introduces a shared
imageTelemetryutility to compute aggregate image counts/bytes/MIME-family/source-category measurements. - Adds image measurements to chat response telemetry (
response.success,response.error,response.cancelled) and Auto mode router telemetry (automode.routerModelSelection,automode.routerFallback). - Adds/updates unit tests validating aggregate measurements and telemetry emission.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/platform/image/common/imageTelemetry.ts | New shared helper that computes aggregate image telemetry measurements from messages/references. |
| extensions/copilot/src/platform/image/common/test/imageTelemetry.spec.ts | New tests for MIME/source/byte aggregation and omission when no images exist. |
| extensions/copilot/src/platform/endpoint/node/automodeService.ts | Adds image aggregate measurements to Auto mode router telemetry events. |
| extensions/copilot/src/platform/endpoint/node/test/automodeService.spec.ts | Updates test to assert router selection telemetry includes image measurements. |
| extensions/copilot/src/extension/prompt/node/chatMLFetcherTelemetry.ts | Extends chat response telemetry to include image aggregate measurements. |
| extensions/copilot/src/extension/prompt/node/chatMLFetcher.ts | Computes image measurements once per request and threads them through success/cancel/error telemetry paths. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 1
Comment on lines
+151
to
+166
| function getImageTelemetryInputFromUrl(url: string, mediaType: string | undefined): ImageTelemetryInput { | ||
| if (!url.startsWith('data:')) { | ||
| return { mimeType: mediaType, source: 'url' }; | ||
| } | ||
|
|
||
| const commaIndex = url.indexOf(','); | ||
| if (commaIndex === -1) { | ||
| return { mimeType: mediaType, source: 'unknown' }; | ||
| } | ||
|
|
||
| const metadata = url.slice(5, commaIndex).split(';'); | ||
| const dataMimeType = metadata[0] || undefined; | ||
| const isBase64 = metadata.includes('base64'); | ||
| return { | ||
| mimeType: mediaType ?? dataMimeType, | ||
| byteLength: isBase64 ? getBase64ByteLength(url.slice(commaIndex + 1)) : undefined, |
962c775 to
0331434
Compare
bryanchen-d
approved these changes
May 21, 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.
This adds non-restricted aggregate image metadata to Copilot chat telemetry.
Changes
response.successresponse.errorresponse.cancelledPrivacy
This does not send image content, base64 payloads, OCR/text extracted from images, file paths, URLs, image IDs, hashes, prompts, or model responses.
The telemetry is limited to aggregate counts/sizes/categories:
Restricted/private telemetry, if needed later, should be added separately through the Hydro/CTS path.