@@ -39,12 +39,15 @@ export type TelemetryData = {
39
39
extension : string ;
40
40
rounds : string ;
41
41
undos : string ;
42
- edits : boolean ;
43
42
unstashed : number ;
43
+ edits : number ;
44
44
finishedByEdit : boolean ;
45
45
startTime : string ;
46
46
endTime : string ;
47
47
editMode : string ;
48
+ acceptedHunks : number ;
49
+ discardedHunks : number ;
50
+ responseTypes : string ;
48
51
} ;
49
52
50
53
export type TelemetryDataClassification = {
@@ -59,6 +62,9 @@ export type TelemetryDataClassification = {
59
62
startTime : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'When the session started' } ;
60
63
endTime : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'When the session ended' } ;
61
64
editMode : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'What edit mode was choosen: live, livePreview, preview' } ;
65
+ acceptedHunks : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; isMeasurement : true ; comment : 'Number of accepted hunks' } ;
66
+ discardedHunks : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; isMeasurement : true ; comment : 'Number of discarded hunks' } ;
67
+ responseTypes : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'Comma separated list of response types like edits, message, mixed' } ;
62
68
} ;
63
69
64
70
export enum ExpansionState {
@@ -140,7 +146,7 @@ export class Session {
140
146
private _isUnstashed : boolean = false ;
141
147
private readonly _exchange : SessionExchange [ ] = [ ] ;
142
148
private readonly _startTime = new Date ( ) ;
143
- private readonly _teldata : Partial < TelemetryData > ;
149
+ private readonly _teldata : TelemetryData ;
144
150
145
151
readonly textModelNAltVersion : number ;
146
152
private _textModelNSnapshotAltVersion : number | undefined ;
@@ -168,12 +174,16 @@ export class Session {
168
174
this . _teldata = {
169
175
extension : provider . debugName ,
170
176
startTime : this . _startTime . toISOString ( ) ,
171
- edits : false ,
177
+ endTime : this . _startTime . toISOString ( ) ,
178
+ edits : 0 ,
172
179
finishedByEdit : false ,
173
180
rounds : '' ,
174
181
undos : '' ,
175
182
editMode,
176
- unstashed : 0
183
+ unstashed : 0 ,
184
+ acceptedHunks : 0 ,
185
+ discardedHunks : 0 ,
186
+ responseTypes : ''
177
187
} ;
178
188
}
179
189
@@ -214,6 +224,7 @@ export class Session {
214
224
this . _isUnstashed = false ;
215
225
const newLen = this . _exchange . push ( exchange ) ;
216
226
this . _teldata . rounds += `${ newLen } |` ;
227
+ this . _teldata . responseTypes += `${ exchange . response instanceof ReplyResponse ? exchange . response . responseType : InlineChatResponseTypes . Empty } |` ;
217
228
}
218
229
219
230
get exchanges ( ) : Iterable < SessionExchange > {
@@ -244,15 +255,25 @@ export class Session {
244
255
}
245
256
246
257
recordExternalEditOccurred ( didFinish : boolean ) {
247
- this . _teldata . edits = true ;
258
+ this . _teldata . edits += 1 ;
248
259
this . _teldata . finishedByEdit = didFinish ;
249
260
}
250
261
251
262
asTelemetryData ( ) : TelemetryData {
252
- return < TelemetryData > {
253
- ...this . _teldata ,
254
- endTime : new Date ( ) . toISOString ( ) ,
255
- } ;
263
+
264
+ for ( const item of this . hunkData . getInfo ( ) ) {
265
+ switch ( item . getState ( ) ) {
266
+ case HunkState . Accepted :
267
+ this . _teldata . acceptedHunks += 1 ;
268
+ break ;
269
+ case HunkState . Rejected :
270
+ this . _teldata . discardedHunks += 1 ;
271
+ break ;
272
+ }
273
+ }
274
+
275
+ this . _teldata . endTime = new Date ( ) . toISOString ( ) ;
276
+ return this . _teldata ;
256
277
}
257
278
258
279
asRecording ( ) : Recording {
0 commit comments