Skip to content

Commit

Permalink
QDS changes integration
Browse files Browse the repository at this point in the history
  • Loading branch information
stuti149 committed Feb 8, 2024
1 parent bcb3c0f commit c9b9316
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PackageReference Update="Microsoft.Azure.Kusto.Data" Version="9.0.4" />
<PackageReference Update="Microsoft.Azure.Kusto.Language" Version="9.0.4" />
<PackageReference Update="Microsoft.SqlServer.Assessment" Version="[1.1.17]" />
<PackageReference Update="Microsoft.SqlServer.Migration.Assessment" Version="1.0.20231130.1" />
<PackageReference Update="Microsoft.SqlServer.Migration.Assessment" Version="1.0.20240206.1" />
<PackageReference Update="Microsoft.SqlServer.Migration.Logins" Version="1.0.20240107.2" />
<PackageReference Update="Microsoft.SqlServer.Management.QueryStoreModel" Version="163.55.1" />
<PackageReference Update="Microsoft.SqlServer.Management.SqlParser" Version="170.9.0" />
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public class MigrationAssessmentsParams
/// Folder path to XEvents files to be assessed, if applicable. Empty string to disable XEvents assessment.
/// </summary>
public string XEventsFilesFolderPath { get; set; }

/// <summary>
/// Bool to enable ad-hoc query collection and extraction through QDS. False if not set.
/// </summary>
public bool collectAdhocQueries { get; set; } = false;
}

public class MigrationAssessmentResult
Expand Down
10 changes: 7 additions & 3 deletions src/Microsoft.SqlTools.Migration/MigrationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ internal async Task HandleMigrationAssessmentsRequest(
connectionStrings.Add(connStringBuilder.ConnectionString);
}
string[] assessmentConnectionStrings = connectionStrings.ToArray();
var results = await GetAssessmentItems(assessmentConnectionStrings, parameters.XEventsFilesFolderPath);
var results = await GetAssessmentItems(assessmentConnectionStrings, parameters.XEventsFilesFolderPath, parameters.collectAdhocQueries);
await requestContext.SendResult(results);
}
}
Expand Down Expand Up @@ -859,14 +859,18 @@ public bool TryGetData(string column, out object value)
}
}

internal async Task<MigrationAssessmentResult> GetAssessmentItems(string[] connectionStrings, string xEventsFilesFolderPath)
internal async Task<MigrationAssessmentResult> GetAssessmentItems(string[] connectionStrings, string xEventsFilesFolderPath, bool collectAdhocQueries)
{
SqlAssessmentConfiguration.EnableLocalLogging = true;
SqlAssessmentConfiguration.ReportsAndLogsRootFolderPath = Path.GetDirectoryName(Logger.LogFileFullPath);

SqlConnectionLocator locator = new SqlConnectionLocator();
AdHocQueriesCollectionParameters parameters = new()
{
CollectAdHocQueries = collectAdhocQueries,
XEventsFilesFolderPath = xEventsFilesFolderPath,
};
locator.ConnectionStrings.AddRange(connectionStrings);
locator.XeventsFilesFolderPath = xEventsFilesFolderPath;
DmaEngine engine = new DmaEngine(locator);

ISqlMigrationAssessmentModel contextualizedAssessmentResult = await engine.GetTargetAssessmentResultsListWithCheck(System.Threading.CancellationToken.None);
Expand Down

0 comments on commit c9b9316

Please sign in to comment.