mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 02:02:35 -05:00
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:
@@ -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.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user