Adding Dacpac extension telemetry and core wizard/page telemetry updates(#13859)

* Dacpac telmetry code changes

* Removed added spaces

* Generate deployScript accessibility changed back to public

* code review suggessions updates

* dacpac extension tests fixes

* Updated time and filesize methods allowing general return values

* Telemetry code updates

* Dacpac Telemetry potential data loss capture and PII error excluded

* Dacpac telemetry code updates for comments

* Wizard pages navigation telemetry event capture moved to the core

* DacpacTelemetry code updates

* Extension wizard cancel telemetry for data loss

* Dacpac telemetry pagename and small code updates

* final Dacpac telemetry code updates...
This commit is contained in:
Sai Avishkar Sreerama
2021-01-21 17:00:37 -06:00
committed by GitHub
parent 07d798c949
commit 0316d9ac57
16 changed files with 282 additions and 63 deletions

View File

@@ -3,6 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
export interface IPackageInfo {
name: string;
version: string;
@@ -22,14 +24,16 @@ export function getPackageInfo(packageJson: any): IPackageInfo | undefined {
}
/**
* Map an error message into a short name for the type of error.
* @param msg The error message to map
* Get file size from the file stats using the file path uri
* If the file does not exists, purposely returning undefined instead of throwing an error for telemetry purpose.
* @param uri The file path
*/
export function getTelemetryErrorType(msg: string): string {
if (msg && msg.indexOf('Object reference not set to an instance of an object') !== -1) {
return 'ObjectReferenceNotSet';
export async function tryGetFileSize(uri: string): Promise<number | undefined> {
try {
const stats = await fs.promises.stat(uri);
return stats?.size;
}
else {
return 'Other';
catch (e) {
return undefined;
}
}