More granular telemetry API (#141086)

* Initial implementation of proposed telemetry API

* TelemetryDetails -> TelemetryConfiguration + proposed guards
This commit is contained in:
Logan Ramos
2022-01-20 13:34:03 -05:00
committed by GitHub
parent f36b3e7025
commit 4475ae1240
6 changed files with 83 additions and 28 deletions

View File

@@ -303,11 +303,19 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostTerminalService.getDefaultShell(false);
},
get isTelemetryEnabled() {
return extHostTelemetry.getTelemetryEnabled();
return extHostTelemetry.getTelemetryConfiguration();
},
get onDidChangeTelemetryEnabled(): Event<boolean> {
return extHostTelemetry.onDidChangeTelemetryEnabled;
},
get telemetryConfiguration(): vscode.TelemetryConfiguration {
checkProposedApiEnabled(extension, 'telemetry');
return extHostTelemetry.getTelemetryDetails();
},
get onDidChangeTelemetryConfiguration(): Event<vscode.TelemetryConfiguration> {
checkProposedApiEnabled(extension, 'telemetry');
return extHostTelemetry.onDidChangeTelemetryConfiguration;
},
get isNewAppInstall() {
const installAge = Date.now() - new Date(initData.telemetryInfo.firstSessionDate).getTime();
return isNaN(installAge) ? false : installAge < 1000 * 60 * 60 * 24; // install age is less than a day