Update logging of updateGraph to match TS protocol changes
For #88313 Also log updateGraph on `completions.execute` instead of as its own event
This commit is contained in:
parent
ce5ffc76c0
commit
fc65a7c41b
|
@ -405,15 +405,17 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
|
|||
"duration" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" },
|
||||
"type" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" },
|
||||
"count" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" },
|
||||
"updateGraphDurationMs" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" },
|
||||
"${include}": [
|
||||
"${TypeScriptCommonProperties}"
|
||||
]
|
||||
}
|
||||
*/
|
||||
this.telemetryReporter.logTelemetry('completions.execute', {
|
||||
duration: duration + '',
|
||||
type: response ? response.type : 'unknown',
|
||||
count: (response && response.type === 'response' && response.body ? response.body.entries.length : 0) + ''
|
||||
duration: duration,
|
||||
type: response?.type ?? 'unknown',
|
||||
count: response?.type === 'response' && response.body ? response.body.entries.length : 0,
|
||||
updateGraphDurationMs: response?.type === 'response' ? response.performanceData?.updateGraphDurationMs : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,13 @@ import * as Proto from 'typescript/lib/protocol';
|
|||
export = Proto;
|
||||
|
||||
declare module "typescript/lib/protocol" {
|
||||
// TODO: Remove this hardcoded type once we update to TS 3.8+ that brings in the proper types
|
||||
interface Response {
|
||||
performanceData?: {
|
||||
updateGraphDurationMs?: number;
|
||||
}
|
||||
}
|
||||
|
||||
const enum CommandTypes {
|
||||
PrepareCallHierarchy = "prepareCallHierarchy",
|
||||
ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls",
|
||||
|
|
|
@ -80,11 +80,6 @@ namespace ServerState {
|
|||
export type State = typeof None | Running | Errored;
|
||||
}
|
||||
|
||||
// TODO: Remove this hardcoded type once we update to TS 3.8+ that brings in the proper types
|
||||
type TS38ResponseWithPerfMetadata = Proto.Response & {
|
||||
updateGraphDurationMs?: number;
|
||||
};
|
||||
|
||||
export default class TypeScriptServiceClient extends Disposable implements ITypeScriptServiceClient {
|
||||
private static readonly WALK_THROUGH_SNIPPET_SCHEME_COLON = `${fileSchemes.walkThroughSnippet}:`;
|
||||
|
||||
|
@ -703,30 +698,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||
private executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise<ServerResponse.Response<Proto.Response>> | undefined {
|
||||
this.bufferSyncSupport.beforeCommand(command);
|
||||
const runningServerState = this.service();
|
||||
return runningServerState.server.executeImpl(command, args, executeInfo).then(result => {
|
||||
if (result?.type === 'response') {
|
||||
this.reportRequestTelemetry(result, command);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
private reportRequestTelemetry(result: TS38ResponseWithPerfMetadata, command: string): void {
|
||||
if (typeof result.updateGraphDurationMs === 'number') {
|
||||
/* __GDPR__
|
||||
"updateGraphPerformance" : {
|
||||
"${include}": [
|
||||
"${TypeScriptCommonProperties}"
|
||||
],
|
||||
"command" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"updateGraphDurationMs" : { "classification": "SystemMetaData", "purpose": "updateGraphDurationMs" }
|
||||
}
|
||||
*/
|
||||
this.logTelemetry('updateGraphPerformance', {
|
||||
command,
|
||||
updateGraphDurationMs: result.updateGraphDurationMs
|
||||
});
|
||||
}
|
||||
return runningServerState.server.executeImpl(command, args, executeInfo);
|
||||
}
|
||||
|
||||
public interruptGetErr<R>(f: () => R): R {
|
||||
|
|
|
@ -14,7 +14,7 @@ interface PackageInfo {
|
|||
}
|
||||
|
||||
export interface TelemetryProperties {
|
||||
readonly [prop: string]: string | number;
|
||||
readonly [prop: string]: string | number | undefined;
|
||||
}
|
||||
|
||||
export interface TelemetryReporter {
|
||||
|
|
Loading…
Reference in a new issue