Skip to content

Commit 36b82a9

Browse files
authored
Address code review comments
- use try/finally - mark telemetry as measurement
1 parent 5da2bd6 commit 36b82a9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/vs/workbench/api/common/extHostCommands.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,8 @@ export class ExtHostCommands implements ExtHostCommandsShape {
237237

238238
const start = Date.now();
239239
try {
240-
const result = await callback.apply(thisArg, args);
241-
this._reportTelemetry(command, id, Date.now() - start);
242-
return result;
240+
return await callback.apply(thisArg, args);
243241
} catch (err) {
244-
this._reportTelemetry(command, id, Date.now() - start);
245242
// The indirection-command from the converter can fail when invoking the actual
246243
// command and in that case it is better to blame the correct command
247244
if (id === this.converter.delegatingCommandId) {
@@ -264,6 +261,9 @@ export class ExtHostCommands implements ExtHostCommandsShape {
264261
}
265262
};
266263
}
264+
finally {
265+
this._reportTelemetry(command, id, Date.now() - start);
266+
}
267267
}
268268

269269
private _reportTelemetry(command: CommandHandler, id: string, duration: number) {
@@ -278,7 +278,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
278278
type ExtensionActionTelemetryMeta = {
279279
extensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The id of the extension handling the command, informing which extensions provide most-used functionality.' };
280280
id: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The id of the command, to understand which specific extension features are most popular.' };
281-
duration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration of the command execution, to detect performance issues' };
281+
duration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'The duration of the command execution, to detect performance issues' };
282282
owner: 'digitarald';
283283
comment: 'Used to gain insight on the most popular commands used from extensions';
284284
};

0 commit comments

Comments
 (0)