Telemetry for Data Workspaces extension (#13846)

* Add CodeQL Analysis workflow (#10195)

* Add CodeQL Analysis workflow

* Fix path

* test commit pls ignore

* telemetry points

* yarn lock changes

* making test xplat friendly

* PR feedback

* Adding additional telemetry points

Co-authored-by: Justin Hutchings <jhutchings1@users.noreply.github.com>
This commit is contained in:
Benjin Dubishar
2021-01-22 14:18:43 -08:00
committed by GitHub
parent e280205340
commit c903cd87bf
18 changed files with 626 additions and 17 deletions

View File

@@ -3,15 +3,43 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import * as utils from './utils';
import * as vscode from 'vscode';
import AdsTelemetryReporter from 'ads-extension-telemetry';
import * as Utils from './utils';
const packageJson = require('../../package.json');
const packageJson = require('../package.json');
let packageInfo = Utils.getPackageInfo(packageJson)!;
let packageInfo = utils.getPackageInfo(packageJson)!;
export const TelemetryReporter = new AdsTelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey);
export enum TelemetryViews {
WorkspaceTreePane = 'WorkspaceTreePane',
OpenExistingDialog = 'OpenExistingDialog',
NewProjectDialog = 'NewProjectDialog',
ProviderRegistration = 'ProviderRegistration'
}
export function calculateRelativity(projectPath: string, workspacePath?: string): string {
workspacePath = workspacePath ?? vscode.workspace.workspaceFile?.fsPath;
if (!workspacePath) {
return 'noWorkspace';
}
const relativePath = path.relative(path.dirname(projectPath), path.dirname(workspacePath));
if (relativePath.length === 0) { // no path difference
return 'sameFolder';
}
const pathParts = relativePath.split(path.sep);
if (pathParts.every(x => x === '..')) {
return 'directAncestor';
}
return 'other'; // sibling, cousin, descendant, etc.
}