mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
* WIP * WIP * WIP * Fix location dropdown not working properly * Clean up comments * Switch button order in selectMigrationServiceDialog * Vbump to 1.0.1 * Refactor to avoid duplicate API calls * Add null checks * Fix migration status dialog not sorting migrations properly * Address comments, remove unnecessary code * Address comments - separate util methods by resource type, use logError instead of console.log * Remove unused methods * Fix DMS creation on newly created resource group * Fix stale account behavior * Address comments - remove telemetry context from util method calls * Clean up imports * Fix dashboard service monitoring not working * Fix null reference on database backup page, and resources not updating properly when location is changed * Fix dashboard not auto selecting DMS after migration started * Add null checks
74 lines
3.3 KiB
TypeScript
74 lines
3.3 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, { TelemetryEventMeasures, TelemetryEventProperties } from '@microsoft/ads-extension-telemetry';
|
|
const packageJson = require('../package.json');
|
|
let packageInfo = {
|
|
name: packageJson.name,
|
|
version: packageJson.version,
|
|
aiKey: packageJson.aiKey
|
|
};
|
|
|
|
export const TelemetryReporter = new AdsTelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey);
|
|
|
|
export enum TelemetryViews {
|
|
SqlServerDashboard = 'SqlServerDashboard',
|
|
CreateDataMigrationServiceDialog = 'CreateDataMigrationServiceDialog',
|
|
AssessmentsDialog = 'AssessmentsDialog',
|
|
DatabaseBackupPage = 'DatabaseBackupPage',
|
|
IntegrationRuntimePage = 'IntegrationRuntimePage',
|
|
MigrationCutoverDialog = 'MigrationCutoverDialog',
|
|
MigrationStatusDialog = 'MigrationStatusDialog',
|
|
MigrationWizardAccountSelectionPage = 'MigrationWizardAccountSelectionPage',
|
|
MigrationWizardSkuRecommendationPage = 'MigrationWizardSkuRecommendationPage',
|
|
MigrationWizardTargetSelectionPage = 'MigrationWizardTargetSelectionPage',
|
|
MigrationWizardIntegrationRuntimePage = 'MigrationWizardIntegrationRuntimePage',
|
|
MigrationWizardSummaryPage = 'MigrationWizardSummaryPage',
|
|
MigrationWizardController = 'MigrationWizardController',
|
|
StartMigrationService = 'StartMigrationSerivce',
|
|
SqlMigrationWizard = 'SqlMigrationWizard',
|
|
MigrationLocalStorage = 'MigrationLocalStorage',
|
|
SkuRecommendationWizard = 'SkuRecommendationWizard',
|
|
DataCollectionWizard = 'GetAzureRecommendationDialog',
|
|
SelectMigrationServiceDialog = 'SelectMigrationServiceDialog',
|
|
Utils = 'Utils'
|
|
}
|
|
|
|
export enum TelemetryAction {
|
|
ServerAssessment = 'ServerAssessment',
|
|
ServerAssessmentIssues = 'ServerAssessmentIssues',
|
|
ServerAssessmentError = 'ServerAssessmentError',
|
|
DatabaseAssessment = 'DatabaseAsssessment',
|
|
DatabaseAssessmentWarning = 'DatabaseAssessmentWarning',
|
|
DatabaseAssessmentError = 'DatabaseAssessmentError',
|
|
StartMigration = 'StartMigration',
|
|
CutoverMigration = 'CutoverMigration',
|
|
CancelMigration = 'CancelMigration',
|
|
MigrationStatus = 'MigrationStatus',
|
|
PageButtonClick = 'PageButtonClick',
|
|
Prev = 'prev',
|
|
Next = 'next',
|
|
Done = 'done',
|
|
Cancel = 'cancel',
|
|
OnPageLeave = 'OnPageLeave',
|
|
GetMISkuRecommendation = 'GetMISkuRecommendation',
|
|
GetVMSkuRecommendation = 'GetVMSkuRecommendation',
|
|
GetInstanceRequirements = 'GetInstanceRequirements',
|
|
StartDataCollection = 'StartDataCollection',
|
|
StopDataCollection = 'StopDataCollection'
|
|
}
|
|
|
|
export function logError(telemetryView: TelemetryViews, err: string, error: any): void {
|
|
console.log(error);
|
|
TelemetryReporter.sendErrorEvent(telemetryView, err);
|
|
}
|
|
|
|
export function sendSqlMigrationActionEvent(telemetryView: TelemetryViews, telemetryAction: TelemetryAction, additionalProps: TelemetryEventProperties, additionalMeasurements: TelemetryEventMeasures): void {
|
|
TelemetryReporter.createActionEvent(telemetryView, telemetryAction)
|
|
.withAdditionalProperties(additionalProps)
|
|
.withAdditionalMeasurements(additionalMeasurements)
|
|
.send();
|
|
}
|