Skip to content

Commit 9e91399

Browse files
authored
Include provider timings in endoflife event (#260333)
1 parent d6cc7d4 commit 9e91399

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

src/vs/editor/common/languages.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,8 @@ export type LifetimeSummary = {
990990
shownDuration: number;
991991
shownDurationUncollapsed: number;
992992
timeUntilShown: number | undefined;
993+
timeUntilProviderRequest: number;
994+
timeUntilProviderResponse: number;
993995
editorType: string;
994996
viewKind: string | undefined;
995997
error: string | undefined;

src/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,14 @@ export function provideInlineCompletions(
8787
}
8888

8989
let result: InlineCompletions | null | undefined;
90+
const providerStartTime = Date.now();
9091
try {
9192
result = await provider.provideInlineCompletions(model, position, contextWithUuid, cancellationTokenSource.token);
9293
} catch (e) {
9394
onUnexpectedExternalError(e);
9495
return undefined;
9596
}
97+
const providerEndTime = Date.now();
9698

9799
if (!result) {
98100
return undefined;
@@ -109,7 +111,7 @@ export function provideInlineCompletions(
109111
}
110112

111113
for (const item of result.items) {
112-
data.push(toInlineSuggestData(item, list, defaultReplaceRange, model, languageConfigurationService, contextWithUuid, requestInfo));
114+
data.push(toInlineSuggestData(item, list, defaultReplaceRange, model, languageConfigurationService, contextWithUuid, requestInfo, { startTime: providerStartTime, endTime: providerEndTime }));
113115
}
114116

115117
return list;
@@ -162,7 +164,8 @@ function toInlineSuggestData(
162164
textModel: ITextModel,
163165
languageConfigurationService: ILanguageConfigurationService | undefined,
164166
context: InlineCompletionContext,
165-
requestInfo: InlineSuggestRequestInfo
167+
requestInfo: InlineSuggestRequestInfo,
168+
providerRequestInfo: InlineSuggestProviderRequestInfo,
166169
): InlineSuggestData {
167170
let insertText: string;
168171
let snippetInfo: SnippetInfo | undefined;
@@ -236,7 +239,8 @@ function toInlineSuggestData(
236239
source,
237240
context,
238241
inlineCompletion.isInlineEdit ?? false,
239-
requestInfo
242+
requestInfo,
243+
providerRequestInfo,
240244
);
241245
}
242246

@@ -249,6 +253,11 @@ export type InlineSuggestRequestInfo = {
249253
typingIntervalCharacterCount: number;
250254
};
251255

256+
export type InlineSuggestProviderRequestInfo = {
257+
startTime: number;
258+
endTime: number;
259+
};
260+
252261
export type InlineSuggestViewData = {
253262
editorType: InlineCompletionEditorType;
254263
renderData?: InlineCompletionViewData;
@@ -283,6 +292,7 @@ export class InlineSuggestData {
283292
public readonly isInlineEdit: boolean,
284293

285294
private readonly _requestInfo: InlineSuggestRequestInfo,
295+
private readonly _providerRequestInfo: InlineSuggestProviderRequestInfo,
286296
) {
287297
this._viewData = { editorType: _requestInfo.editorType };
288298
}
@@ -350,6 +360,8 @@ export class InlineSuggestData {
350360
shownDurationUncollapsed: this._showUncollapsedDuration,
351361
preceeded: this._isPreceeded,
352362
timeUntilShown: this._timeUntilShown,
363+
timeUntilProviderRequest: this._providerRequestInfo.startTime - this._requestInfo.startTime,
364+
timeUntilProviderResponse: this._providerRequestInfo.endTime - this._requestInfo.startTime,
353365
editorType: this._viewData.editorType,
354366
languageId: this._requestInfo.languageId,
355367
requestReason: this._requestInfo.reason,

src/vs/monaco.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7630,6 +7630,8 @@ declare namespace monaco.languages {
76307630
shownDuration: number;
76317631
shownDurationUncollapsed: number;
76327632
timeUntilShown: number | undefined;
7633+
timeUntilProviderRequest: number;
7634+
timeUntilProviderResponse: number;
76337635
editorType: string;
76347636
viewKind: string | undefined;
76357637
error: string | undefined;

src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,8 @@ export class MainThreadLanguageFeatures extends Disposable implements MainThread
655655
shownDuration: lifetimeSummary.shownDuration,
656656
shownDurationUncollapsed: lifetimeSummary.shownDurationUncollapsed,
657657
timeUntilShown: lifetimeSummary.timeUntilShown,
658+
timeUntilProviderRequest: lifetimeSummary.timeUntilProviderRequest,
659+
timeUntilProviderResponse: lifetimeSummary.timeUntilProviderResponse,
658660
editorType: lifetimeSummary.editorType,
659661
viewKind: lifetimeSummary.viewKind,
660662
preceeded: lifetimeSummary.preceeded,
@@ -1311,6 +1313,8 @@ type InlineCompletionEndOfLifeEvent = {
13111313
shownDuration: number;
13121314
shownDurationUncollapsed: number;
13131315
timeUntilShown: number | undefined;
1316+
timeUntilProviderRequest: number;
1317+
timeUntilProviderResponse: number;
13141318
reason: 'accepted' | 'rejected' | 'ignored';
13151319
partiallyAccepted: number;
13161320
preceeded: boolean;
@@ -1342,6 +1346,8 @@ type InlineCompletionsEndOfLifeClassification = {
13421346
shownDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown' };
13431347
shownDurationUncollapsed: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown without collapsing' };
13441348
timeUntilShown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };
1349+
timeUntilProviderRequest: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be requested from the provider' };
1350+
timeUntilProviderResponse: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };
13451351
reason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason for the inline completion ending' };
13461352
partiallyAccepted: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How often the inline completion was partially accepted by the user' };
13471353
preceeded: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was preceeded by another one' };

0 commit comments

Comments
 (0)