mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 09:35:38 -05:00
* Added publish and schema compare telemetry * Adding telemetry points for add/exclude/delete * telemetry for validation * Adding telemetry from project roundtrip updates, editing sqlproj, and db refs * Changed method for obtaining extension ID during registration * Fixing test failures, updating ads telemetry package dependency * replacing action strings with enums * change database project string actions to enums * Changed action name to better match dialog * PR feedback
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import AdsTelemetryReporter from '@microsoft/ads-extension-telemetry';
|
|
import * as path from 'path';
|
|
import * as utils from './utils';
|
|
import * as vscode from 'vscode';
|
|
|
|
const packageJson = require('../../package.json');
|
|
|
|
let packageInfo = utils.getPackageInfo(packageJson)!;
|
|
|
|
export const TelemetryReporter = new AdsTelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey);
|
|
|
|
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.
|
|
}
|
|
|
|
|
|
export enum TelemetryViews {
|
|
WorkspaceTreePane = 'WorkspaceTreePane',
|
|
OpenExistingDialog = 'OpenExistingDialog',
|
|
NewProjectDialog = 'NewProjectDialog',
|
|
ProviderRegistration = 'ProviderRegistration'
|
|
}
|
|
|
|
export enum TelemetryActions {
|
|
ProviderRegistered = 'ProviderRegistered',
|
|
ProjectAddedToWorkspace = 'ProjectAddedToWorkspace',
|
|
ProjectRemovedFromWorkspace = 'ProjectRemovedFromWorkspace',
|
|
OpeningProject = 'OpeningProject',
|
|
NewProjectDialogLaunched = 'NewProjectDialogLaunched',
|
|
OpeningWorkspace = 'OpeningWorkspace',
|
|
OpenExistingDialogLaunched = 'OpenExistingDialogLaunched',
|
|
NewProjectDialogCompleted = 'NewProjectDialogCompleted'
|
|
}
|