Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QDS ADS integration #25306

Merged
merged 4 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/sql-migration/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.migration-{#fileName#}",
"useDefaultLinuxRuntime": true,
"version": "4.11.0.17",
"version": "4.12.0.2",
"downloadFileNames": {
"Windows_86": "win-x86-net7.0.zip",
"Windows": "win-x64-net7.0.zip",
Expand Down
6 changes: 4 additions & 2 deletions extensions/sql-migration/src/constants/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ export const DATABASE_FOR_ASSESSMENT_PAGE_TITLE = localize('sql.migration.databa
export const DATABASE_FOR_ASSESSMENT_DESCRIPTION = localize('sql.migration.database.assessment.description', "Select the databases that you want to assess for migration to Azure SQL.");

// XEvents assessment
export const XEVENTS_ASSESSMENT_TITLE = localize('sql.migration.database.assessment.xevents.title', "Assess extended event sessions");
export const XEVENTS_ASSESSMENT_DESCRIPTION = localize('sql.migration.database.assessment.xevents.description', "For the selected databases, optionally provide extended event session files to assess ad-hoc or dynamic SQL queries or any DML statements initiated through the application data layer. {0}");
export const XEVENTS_ASSESSMENT_TITLE = localize('sql.migration.database.assessment.xevents.title', "Assess Ad-hoc or dynamic SQL");
export const XEVENTS_ASSESSMENT_DESCRIPTION = localize('sql.migration.database.assessment.xevents.description', "For the selected databases, select the option you want to assess ad-hoc or dynamic SQL queries or any DML statements initiated through the application data layer. {0}");
export const XEVENTS_ASSESSMENT_HELPLINK = localize('sql.migration.database.assessment.xevents.link', "Learn more");
export const XEVENTS_ASSESSMENT_OPEN_FOLDER = localize('sql.migration.database.assessment.xevents.instructions', "Select a folder where extended events session files (.xel and .xem) are stored");
export const QDS_ASSESSMENT_LABEL = localize('sql.migration.database.assessment.qds.label', "Using Query Data Store (this option is available for Microsoft SQL Server 2016 and later)");
export const XEVENTS_LABEL = localize('sql.migration.database.assessment.xevents.label', "Using extended event session");
stuti149 marked this conversation as resolved.
Show resolved Hide resolved

// Assessment results
export const ASSESSMENT_RESULTS_PAGE_TITLE = localize('sql.migration.assessment.results.title', "Target platform & assessment results");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Page, SavedInfo } from '../../models/stateMachine';
export function parseAssessmentReport(assessmentReport: any): any {
const saveInfo: SavedInfo = {
xEventsFilesFolderPath: null,
collectAdhocQueries: null,
closedPage: Page.ImportAssessment,
databaseAssessment: [],
databaseList: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export class RestartMigrationDialog {
sqlMigrationService: serviceContext.migrationService,
serviceSubscription: null,
serviceResourceGroup: null,
xEventsFilesFolderPath: null
xEventsFilesFolderPath: null,
collectAdhocQueries: null
};

const getStorageAccountResourceGroup = (storageAccountResourceId: string): azureResource.AzureResourceResourceGroup => {
Expand Down
6 changes: 5 additions & 1 deletion extensions/sql-migration/src/models/stateMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export interface SavedInfo {
serviceResourceGroup: azurecore.azureResource.AzureResourceResourceGroup | null;
serverAssessment: ServerAssessment | null;
xEventsFilesFolderPath: string | null;
collectAdhocQueries: boolean | null;
skuRecommendation: SkuRecommendationSavedInfo | null;
}

Expand Down Expand Up @@ -214,6 +215,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {

public _databasesForAssessment!: string[];
public _xEventsFilesFolderPath: string = '';
public _collectAdhocQueries: boolean = false;
public _assessmentResults!: ServerAssessment;
public _assessedDatabaseList!: string[];
public _runAssessments: boolean = true;
Expand Down Expand Up @@ -408,7 +410,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
public async getDatabaseAssessments(targetType: MigrationTargetType[]): Promise<ServerAssessment> {
const connectionString = await getSourceConnectionString();
try {
const response = (await this.migrationService.getAssessments(connectionString, this._databasesForAssessment, this._xEventsFilesFolderPath ?? ''))!;
const response = (await this.migrationService.getAssessments(connectionString, this._databasesForAssessment, this._xEventsFilesFolderPath ?? '', this._collectAdhocQueries ?? false))!;
this._assessmentApiResponse = response;
this._assessedDatabaseList = this._databasesForAssessment.slice();

Expand Down Expand Up @@ -1276,6 +1278,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
sqlMigrationService: undefined,
serverAssessment: null,
xEventsFilesFolderPath: null,
collectAdhocQueries: null,
skuRecommendation: null,
serviceResourceGroup: null,
serviceSubscription: null,
Expand Down Expand Up @@ -1374,6 +1377,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
this._assessedDatabaseList = this.savedInfo.databaseAssessment ?? [];
this._databasesForAssessment = this.savedInfo.databaseAssessment ?? [];
this._xEventsFilesFolderPath = this.savedInfo.xEventsFilesFolderPath ?? '';
this._collectAdhocQueries = this.savedInfo.collectAdhocQueries ?? false;
const savedAssessmentResults = this.savedInfo.serverAssessment;
if (savedAssessmentResults) {
this._assessmentResults = savedAssessmentResults;
Expand Down
3 changes: 2 additions & 1 deletion extensions/sql-migration/src/service/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface SqlMigrationAssessmentParams {
connectionString: string;
databases: string[];
xEventsFilesFolderPath: string;
collectAdhocQueries: boolean;
}

export interface SqlMigrationImpactedObjectInfo {
Expand Down Expand Up @@ -535,7 +536,7 @@ export namespace LoginMigrationNotification {

export interface ISqlMigrationService {
providerId: string;
getAssessments(ownerUri: string, databases: string[], xEventsFilesFolderPath: string): Thenable<AssessmentResult | undefined>;
getAssessments(ownerUri: string, databases: string[], xEventsFilesFolderPath: string, collectAdhocQueries: boolean): Thenable<AssessmentResult | undefined>;
getSkuRecommendations(dataFolder: string, perfQueryIntervalInSec: number, targetPlatforms: string[], targetSqlInstance: string, targetPercentile: number, scalingFactor: number, startTime: string, endTime: string, includePreviewSkus: boolean, databaseAllowList: string[]): Promise<SkuRecommendationResult | undefined>;
startPerfDataCollection(ownerUri: string, dataFolder: string, perfQueryIntervalInSec: number, staticQueryIntervalInSec: number, numberOfIterations: number): Promise<StartPerfDataCollectionResult | undefined>;
stopPerfDataCollection(): Promise<StopPerfDataCollectionResult | undefined>;
Expand Down
4 changes: 2 additions & 2 deletions extensions/sql-migration/src/service/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export class SqlMigrationService extends MigrationExtensionService implements co
// this isn't explicitly necessary
}

async getAssessments(connectionString: string, databases: string[], xEventsFilesFolderPath: string): Promise<contracts.AssessmentResult | undefined> {
let params: contracts.SqlMigrationAssessmentParams = { connectionString: connectionString, databases: databases, xEventsFilesFolderPath: xEventsFilesFolderPath };
async getAssessments(connectionString: string, databases: string[], xEventsFilesFolderPath: string, collectAdhocQueries: boolean): Promise<contracts.AssessmentResult | undefined> {
let params: contracts.SqlMigrationAssessmentParams = { connectionString: connectionString, databases: databases, xEventsFilesFolderPath: xEventsFilesFolderPath, collectAdhocQueries: collectAdhocQueries };
try {
return this._client.sendRequest(contracts.GetSqlMigrationAssessmentItemsRequest.type, params);
}
Expand Down
20 changes: 19 additions & 1 deletion extensions/sql-migration/src/wizard/databaseSelectorPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
private _databaseTableValues!: any[];
private _disposables: vscode.Disposable[] = [];
private _enableNavigationValidation: boolean = true;
private _adhocQueryCollectionCheckbox!: azdata.CheckBoxComponent;

private readonly TABLE_WIDTH = 650;

Expand Down Expand Up @@ -83,6 +84,7 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
}

this._xEventsFilesFolderPath = this.migrationStateModel._xEventsFilesFolderPath;
this._adhocQueryCollectionCheckbox.checked = this.migrationStateModel._collectAdhocQueries;
}

public async onPageLeave(): Promise<void> {
Expand All @@ -104,6 +106,7 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
|| this.migrationStateModel._xEventsFilesFolderPath.toLowerCase() !== this._xEventsFilesFolderPath.toLowerCase();

this.migrationStateModel._xEventsFilesFolderPath = this._xEventsFilesFolderPath;
this.migrationStateModel._collectAdhocQueries = this._adhocQueryCollectionCheckbox.checked ?? false;
}

protected async handleStateChange(e: StateChangeEvent): Promise<void> {
Expand Down Expand Up @@ -298,15 +301,30 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
xEventsFolderPickerClearButton
]).component();

this._adhocQueryCollectionCheckbox = this._view.modelBuilder.checkBox().withProps({
label: constants.QDS_ASSESSMENT_LABEL,
checked: false,
CSSStyles: { ...styles.BODY_CSS, 'margin-bottom': '8px' }
}).component();

const xEventCheckBox = this._view.modelBuilder.checkBox().withProps({
label: constants.XEVENTS_LABEL,
checked: false,
CSSStyles: { ...styles.BODY_CSS }
}).component();

this._xEventsGroup = this._view.modelBuilder.groupContainer()
.withLayout({
header: constants.XEVENTS_ASSESSMENT_TITLE,
collapsible: true,
collapsed: true
}).withItems([
xEventsDescription,
this._adhocQueryCollectionCheckbox,
xEventCheckBox,
xEventsInstructions,
xEventsFolderPickerContainer
xEventsFolderPickerContainer,
this._adhocQueryCollectionCheckbox
]).component();

const flex = view.modelBuilder.flexContainer().withLayout({
Expand Down