-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Track strings to calculate codeSurvivalRate #2365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -305,10 +305,22 @@ function reportEditSurvivalEvent(res: EditSurvivalResult, { requestId, speculati | |||||||||
| "survivalRateFourGram": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The rate between 0 and 1 of how much of the AI edit is still present in the document." }, | ||||||||||
| "survivalRateNoRevert": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The rate between 0 and 1 of how much of the ranges the AI touched ended up being reverted." }, | ||||||||||
| "didBranchChange": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Indicates if the branch changed in the meantime. If the branch changed (value is 1), this event should probably be ignored." }, | ||||||||||
| "timeDelayMs": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The time delay between the user accepting the edit and measuring the survival rate." } | ||||||||||
| "timeDelayMs": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The time delay between the user accepting the edit and measuring the survival rate." }, | ||||||||||
| "textBeforeAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings before AI edits were applied for each edit region." }, | ||||||||||
| "textAfterAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after AI edits were applied for each edit region." }, | ||||||||||
| "textAfterUserEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after user modifications for each edit region." } | ||||||||||
| } | ||||||||||
| */ | ||||||||||
| res.telemetryService.sendMSFTTelemetryEvent('codeMapper.trackEditSurvival', { requestId, speculationRequestId, requestSource, chatRequestModel, mapper }, { | ||||||||||
| res.telemetryService.sendMSFTTelemetryEvent('codeMapper.trackEditSurvival', { | ||||||||||
| requestId, | ||||||||||
| speculationRequestId, | ||||||||||
| requestSource, | ||||||||||
| chatRequestModel, | ||||||||||
| mapper, | ||||||||||
| textBeforeAiEdits: res.textBeforeAiEdits ? JSON.stringify(res.textBeforeAiEdits) : undefined, | ||||||||||
| textAfterAiEdits: res.textAfterAiEdits ? JSON.stringify(res.textAfterAiEdits) : undefined, | ||||||||||
| textAfterUserEdits: res.textAfterUserEdits ? JSON.stringify(res.textAfterUserEdits) : undefined, | ||||||||||
|
Comment on lines
+320
to
+322
|
||||||||||
| textBeforeAiEdits: res.textBeforeAiEdits ? JSON.stringify(res.textBeforeAiEdits) : undefined, | |
| textAfterAiEdits: res.textAfterAiEdits ? JSON.stringify(res.textAfterAiEdits) : undefined, | |
| textAfterUserEdits: res.textAfterUserEdits ? JSON.stringify(res.textAfterUserEdits) : undefined, | |
| // Removed textBeforeAiEdits, textAfterAiEdits, textAfterUserEdits from regular telemetry event |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -307,10 +307,20 @@ export abstract class AbstractReplaceStringTool<T extends { explanation: string | |||||||||||||
| "survivalRateFourGram": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The rate between 0 and 1 of how much of the AI edit is still present in the document." }, | ||||||||||||||
| "survivalRateNoRevert": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The rate between 0 and 1 of how much of the ranges the AI touched ended up being reverted." }, | ||||||||||||||
| "didBranchChange": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Indicates if the branch changed in the meantime. If the branch changed (value is 1), this event should probably be ignored." }, | ||||||||||||||
| "timeDelayMs": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The time delay between the user accepting the edit and measuring the survival rate." } | ||||||||||||||
| "timeDelayMs": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The time delay between the user accepting the edit and measuring the survival rate." }, | ||||||||||||||
| "textBeforeAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings before AI edits were applied for each edit region." }, | ||||||||||||||
| "textAfterAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after AI edits were applied for each edit region." }, | ||||||||||||||
| "textAfterUserEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after user modifications for each edit region." } | ||||||||||||||
|
Comment on lines
+311
to
+313
|
||||||||||||||
| "textBeforeAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings before AI edits were applied for each edit region." }, | |
| "textAfterAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after AI edits were applied for each edit region." }, | |
| "textAfterUserEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after user modifications for each edit region." } | |
| "textBeforeAiEdits": { "classification": "CustomerContent", "purpose": "FeatureInsight", "comment": "Array of text strings before AI edits were applied for each edit region." }, | |
| "textAfterAiEdits": { "classification": "CustomerContent", "purpose": "FeatureInsight", "comment": "Array of text strings after AI edits were applied for each edit region." }, | |
| "textAfterUserEdits": { "classification": "CustomerContent", "purpose": "FeatureInsight", "comment": "Array of text strings after user modifications for each edit region." } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -390,10 +390,20 @@ export class ApplyPatchTool implements ICopilotTool<IApplyPatchToolParams> { | |||||||||||||
| "survivalRateFourGram": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The rate between 0 and 1 of how much of the AI edit is still present in the document." }, | ||||||||||||||
| "survivalRateNoRevert": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The rate between 0 and 1 of how much of the ranges the AI touched ended up being reverted." }, | ||||||||||||||
| "didBranchChange": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Indicates if the branch changed in the meantime. If the branch changed (value is 1), this event should probably be ignored." }, | ||||||||||||||
| "timeDelayMs": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The time delay between the user accepting the edit and measuring the survival rate." } | ||||||||||||||
| "timeDelayMs": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The time delay between the user accepting the edit and measuring the survival rate.", | ||||||||||||||
| "textBeforeAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings before AI edits were applied for each edit region." }, | ||||||||||||||
| "textAfterAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after AI edits were applied for each edit region." }, | ||||||||||||||
| "textAfterUserEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after user modifications for each edit region." }} | ||||||||||||||
|
Comment on lines
+394
to
+396
|
||||||||||||||
| "textBeforeAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings before AI edits were applied for each edit region." }, | |
| "textAfterAiEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after AI edits were applied for each edit region." }, | |
| "textAfterUserEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Array of text strings after user modifications for each edit region." }} | |
| "textBeforeAiEdits": { "classification": "CustomerContent", "purpose": "FeatureInsight", "comment": "Array of text strings before AI edits were applied for each edit region." }, | |
| "textAfterAiEdits": { "classification": "CustomerContent", "purpose": "FeatureInsight", "comment": "Array of text strings after AI edits were applied for each edit region." }, | |
| "textAfterUserEdits": { "classification": "CustomerContent", "purpose": "FeatureInsight", "comment": "Array of text strings after user modifications for each edit region." }} |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performance concern: JSON.stringify() is called on potentially large arrays of text strings for every telemetry event. If users make many edits across large code regions, this could create performance overhead. Consider:
- Limiting the size or number of text entries tracked
- Truncating long text strings before serialization
- Caching the stringified result if the same data is sent to multiple telemetry events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security concern: The GDPR metadata for
textBeforeAiEdits,textAfterAiEdits, andtextAfterUserEditsis missing proper data classification. These fields contain user code which may include sensitive information and should have appropriate"classification"metadata specified.