mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 17:23:15 -05:00
Add more telemetry props to sql migration extension (#17026)
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { getMigrationStatus, DatabaseMigration, startMigrationCutover, stopMigration, getMigrationAsyncOperationDetails, AzureAsyncOperationResource, BackupFileInfo } from '../../api/azure';
|
||||
import { getMigrationStatus, DatabaseMigration, startMigrationCutover, stopMigration, getMigrationAsyncOperationDetails, AzureAsyncOperationResource, BackupFileInfo, getResourceGroupFromId } from '../../api/azure';
|
||||
import { MigrationContext } from '../../models/migrationLocalStorage';
|
||||
import { sendSqlMigrationActionEvent, TelemetryAction, TelemetryViews } from '../../telemtery';
|
||||
import * as constants from '../../constants/strings';
|
||||
import { getMigrationTargetType, getMigrationMode } from '../../constants/helper';
|
||||
|
||||
export class MigrationCutoverDialogModel {
|
||||
|
||||
@@ -57,8 +58,8 @@ export class MigrationCutoverDialogModel {
|
||||
TelemetryViews.MigrationCutoverDialog,
|
||||
TelemetryAction.CutoverMigration,
|
||||
{
|
||||
'sessionId': this._migration.sessionId!,
|
||||
'migrationEndTime': new Date().toString()
|
||||
...this.getTelemetryProps(this._migration),
|
||||
'migrationEndTime': new Date().toString(),
|
||||
},
|
||||
{}
|
||||
);
|
||||
@@ -84,7 +85,8 @@ export class MigrationCutoverDialogModel {
|
||||
TelemetryViews.MigrationCutoverDialog,
|
||||
TelemetryAction.CancelMigration,
|
||||
{
|
||||
'sessionId': this._migration.sessionId!,
|
||||
...this.getTelemetryProps(this._migration),
|
||||
'migrationMode': getMigrationMode(this._migration),
|
||||
'cutoverStartTime': cutoverStartTime
|
||||
},
|
||||
{}
|
||||
@@ -131,4 +133,17 @@ export class MigrationCutoverDialogModel {
|
||||
});
|
||||
return files;
|
||||
}
|
||||
|
||||
private getTelemetryProps(migration: MigrationContext) {
|
||||
return {
|
||||
'sessionId': migration.sessionId!,
|
||||
'subscriptionId': migration.subscription.id,
|
||||
'resourceGroup': getResourceGroupFromId(migration.targetManagedInstance.id),
|
||||
'sqlServerName': migration.sourceConnectionProfile.serverName,
|
||||
'sourceDatabaseName': migration.migrationContext.properties.sourceDatabaseName,
|
||||
'targetType': getMigrationTargetType(migration),
|
||||
'targetDatabaseName': migration.migrationContext.name,
|
||||
'targetServerName': migration.targetManagedInstance.name,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import { clearDialogMessage, convertTimeDifferenceToDuration, filterMigrations,
|
||||
import { SqlMigrationServiceDetailsDialog } from '../sqlMigrationService/sqlMigrationServiceDetailsDialog';
|
||||
import { ConfirmCutoverDialog } from '../migrationCutover/confirmCutoverDialog';
|
||||
import { MigrationCutoverDialogModel } from '../migrationCutover/migrationCutoverDialogModel';
|
||||
import { getMigrationTargetType, getMigrationMode } from '../../constants/helper';
|
||||
|
||||
const refreshFrequency: SupportedAutoRefreshIntervals = 180000;
|
||||
|
||||
@@ -326,8 +327,8 @@ export class MigrationStatusDialog {
|
||||
return [
|
||||
{ value: this._getDatabaserHyperLink(migration) },
|
||||
{ value: this._getMigrationStatus(migration) },
|
||||
{ value: this._getMigrationMode(migration) },
|
||||
{ value: this._getMigrationTargetType(migration) },
|
||||
{ value: getMigrationMode(migration) },
|
||||
{ value: getMigrationTargetType(migration) },
|
||||
{ value: migration.targetManagedInstance.name },
|
||||
{ value: migration.controller.name },
|
||||
{
|
||||
@@ -404,21 +405,11 @@ export class MigrationStatusDialog {
|
||||
return '---';
|
||||
}
|
||||
|
||||
private _getMigrationTargetType(migration: MigrationContext): string {
|
||||
return migration.targetManagedInstance.type === 'microsoft.sql/managedinstances'
|
||||
? loc.SQL_MANAGED_INSTANCE
|
||||
: loc.SQL_VIRTUAL_MACHINE;
|
||||
}
|
||||
|
||||
private _getMigrationMode(migration: MigrationContext): string {
|
||||
return migration.migrationContext.properties.autoCutoverConfiguration?.autoCutover?.valueOf() ? loc.OFFLINE : loc.ONLINE;
|
||||
}
|
||||
|
||||
private _getMenuCommands(migration: MigrationContext): string[] {
|
||||
const menuCommands: string[] = [];
|
||||
const migrationStatus = migration?.migrationContext?.properties?.migrationStatus;
|
||||
|
||||
if (this._getMigrationMode(migration) === loc.ONLINE &&
|
||||
if (getMigrationMode(migration) === loc.ONLINE &&
|
||||
this.canCutoverMigration(migrationStatus)) {
|
||||
menuCommands.push(MenuCommands.Cutover);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user