mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Support enabling connection pooling (on demand) + additional telemetry (#23664)
This commit is contained in:
@@ -436,6 +436,11 @@
|
||||
"description": "%mssql.enableSqlAuthenticationProvider%",
|
||||
"default": true
|
||||
},
|
||||
"mssql.enableConnectionPooling": {
|
||||
"type": "boolean",
|
||||
"description": "%mssql.enableConnectionPooling%",
|
||||
"default": false
|
||||
},
|
||||
"mssql.tableDesigner.preloadDatabaseModel": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
|
||||
@@ -176,6 +176,7 @@
|
||||
"title.changeNotebookConnection": "Change SQL Notebook Connection",
|
||||
"mssql.parallelMessageProcessing": "[Experimental] Whether the requests to the SQL Tools Service should be handled in parallel. This is introduced to discover the issues there might be when handling all requests in parallel. The default value is false. Azure Data Studio is required to be relaunched when the value is changed.",
|
||||
"mssql.enableSqlAuthenticationProvider": "Enables use of the Sql Authentication Provider for 'Active Directory Interactive' authentication mode when user selects 'AzureMFA' authentication. This enables Server-side resource endpoint integration when fetching access tokens. This option is only supported for 'MSAL' Azure Authentication Library. Azure Data Studio is required to be relaunched when the value is changed.",
|
||||
"mssql.enableConnectionPooling": "Enables connection pooling on MSSQL connections to improve overall performance of Azure Data Studio connectivity. This setting is disabled by default. Azure Data Studio is required to be relaunched when the value is changed.",
|
||||
"mssql.tableDesigner.preloadDatabaseModel": "Whether to preload the database model when the database node in the object explorer is expanded. When enabled, the loading time of table designer can be reduced. Note: You might see higher than normal memory usage if you need to expand a lot of database nodes.",
|
||||
"mssql.tableDesigner.allowDisableAndReenableDdlTriggers": "Whether to allow table designer to disable and re-enable DDL triggers during publish",
|
||||
"mssql.objectExplorer.groupBySchema": "When enabled, the database objects in Object Explorer will be categorized by schema.",
|
||||
|
||||
@@ -29,6 +29,9 @@ export const ObjectManagementService = 'objectManagementService';
|
||||
|
||||
// CONFIGURATION VALUES //////////////////////////////////////////////////////////
|
||||
export const configObjectExplorerGroupBySchemaFlagName = 'mssql.objectExplorer.groupBySchema';
|
||||
export const configAsyncParallelProcessingName = 'mssql.parallelMessageProcessing';
|
||||
export const configEnableSqlAuthenticationProviderName = 'mssql.enableSqlAuthenticationProvider';
|
||||
export const configEnableConnectionPoolingName = 'mssql.enableConnectionPooling';
|
||||
|
||||
// COMMANDNAMES //////////////////////////////////////////////////////////
|
||||
export const cmdObjectExplorerEnableGroupBySchemaCommand = 'mssql.enableGroupBySchema';
|
||||
|
||||
@@ -134,6 +134,24 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
|
||||
}
|
||||
});
|
||||
}
|
||||
if (e.affectsConfiguration(Constants.configAsyncParallelProcessingName)) {
|
||||
if (Utils.getParallelMessageProcessingConfig()) {
|
||||
TelemetryReporter.sendActionEvent(TelemetryViews.MssqlConnections, TelemetryActions.EnableFeatureAsyncParallelProcessing);
|
||||
}
|
||||
await displayReloadAds();
|
||||
}
|
||||
if (e.affectsConfiguration(Constants.configEnableSqlAuthenticationProviderName)) {
|
||||
if (Utils.getEnableSqlAuthenticationProviderConfig()) {
|
||||
TelemetryReporter.sendActionEvent(TelemetryViews.MssqlConnections, TelemetryActions.EnableFeatureSqlAuthenticationProvider);
|
||||
}
|
||||
await displayReloadAds();
|
||||
}
|
||||
if (e.affectsConfiguration(Constants.configEnableConnectionPoolingName)) {
|
||||
if (Utils.getEnableConnectionPoolingConfig()) {
|
||||
TelemetryReporter.sendActionEvent(TelemetryViews.MssqlConnections, TelemetryActions.EnableFeatureConnectionPooling);
|
||||
}
|
||||
await displayReloadAds();
|
||||
}
|
||||
}));
|
||||
|
||||
registerTableDesignerCommands(appContext);
|
||||
@@ -146,6 +164,22 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
|
||||
return createMssqlApi(appContext, server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display notification with action to reload ADS
|
||||
* @returns true if button is clicked, false otherwise.
|
||||
*/
|
||||
async function displayReloadAds(): Promise<boolean> {
|
||||
const reloadPrompt = localize('mssql.reloadPrompt', "This setting requires Azure Data Studio to be reloaded to take into effect.");
|
||||
const reloadChoice = localize('mssql.reloadChoice', "Reload Azure Data Studio");
|
||||
const result = await vscode.window.showInformationMessage(reloadPrompt, reloadChoice);
|
||||
if (result === reloadChoice) {
|
||||
await vscode.commands.executeCommand('workbench.action.reloadWindow');
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const logFiles = ['resourceprovider.log', 'sqltools.log', 'credentialstore.log'];
|
||||
function registerLogCommand(context: vscode.ExtensionContext) {
|
||||
context.subscriptions.push(vscode.commands.registerCommand('mssql.showLogFile', async () => {
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as path from 'path';
|
||||
import * as azurecore from 'azurecore';
|
||||
import { getAzureAuthenticationLibraryConfig, getCommonLaunchArgsAndCleanupOldLogFiles, getConfigTracingLevel, getEnableSqlAuthenticationProviderConfig, getOrDownloadServer, getParallelMessageProcessingConfig, logDebug, TracingLevel } from './utils';
|
||||
import { getAzureAuthenticationLibraryConfig, getCommonLaunchArgsAndCleanupOldLogFiles, getConfigTracingLevel, getEnableConnectionPoolingConfig, getEnableSqlAuthenticationProviderConfig, getOrDownloadServer, getParallelMessageProcessingConfig, logDebug, TracingLevel } from './utils';
|
||||
import { TelemetryReporter, LanguageClientErrorHandler } from './telemetry';
|
||||
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
|
||||
import { TelemetryFeature, AgentServicesFeature, SerializationFeature, AccountFeature, SqlAssessmentServicesFeature, ProfilerFeature, TableDesignerFeature, ExecutionPlanServiceFeature } from './features';
|
||||
@@ -167,6 +167,10 @@ function generateServerOptions(logPath: string, executablePath: string): ServerO
|
||||
if (azureAuthLibrary === 'MSAL' && enableSqlAuthenticationProvider === true) {
|
||||
launchArgs.push('--enable-sql-authentication-provider');
|
||||
}
|
||||
const enableConnectionPooling = getEnableConnectionPoolingConfig()
|
||||
if (enableConnectionPooling) {
|
||||
launchArgs.push('--enable-connection-pooling');
|
||||
}
|
||||
return { command: executablePath, args: launchArgs, transport: TransportKind.stdio };
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,8 @@ export class LanguageClientErrorHandler implements ErrorHandler {
|
||||
}
|
||||
|
||||
export enum TelemetryViews {
|
||||
MssqlObjectExplorer = 'mssqlObjectExplorer'
|
||||
MssqlObjectExplorer = 'mssqlObjectExplorer',
|
||||
MssqlConnections = 'mssqlConnections'
|
||||
}
|
||||
|
||||
export enum TelemetryActions {
|
||||
@@ -93,4 +94,7 @@ export enum TelemetryActions {
|
||||
DisableGroupBySchemaContextMenu = 'objectExplorerDisableGroupBySchemaContextMenu',
|
||||
EnableGroupByServerViewTitleAction = 'objectExplorerEnableGroupByServerViewTitleAction',
|
||||
DisableGroupByServerViewTitleAction = 'objectExplorerDisableGroupByServerViewTitleAction',
|
||||
EnableFeatureAsyncParallelProcessing = 'enableFeatureAsyncParallelProcessing',
|
||||
EnableFeatureSqlAuthenticationProvider = 'enableFeatureSqlAuthenticationProvider',
|
||||
EnableFeatureConnectionPooling = 'enableFeatureConnectionPooling',
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ const extensionConfigSectionName = 'mssql';
|
||||
const configLogDebugInfo = 'logDebugInfo';
|
||||
const parallelMessageProcessingConfig = 'parallelMessageProcessing';
|
||||
const enableSqlAuthenticationProviderConfig = 'enableSqlAuthenticationProvider';
|
||||
const enableConnectionPoolingConfig = 'enableConnectionPooling';
|
||||
const tableDesignerPreloadConfig = 'tableDesigner.preloadDatabaseModel';
|
||||
|
||||
const azureExtensionConfigName = 'azure';
|
||||
@@ -143,6 +144,10 @@ export function setConfigPreloadDatabaseModel(enable: boolean): void {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves configuration `mssql:parallelMessageProcessing` from settings file.
|
||||
* @returns true if setting is enabled in ADS or running ADS in dev mode.
|
||||
*/
|
||||
export function getParallelMessageProcessingConfig(): boolean {
|
||||
const config = getConfiguration();
|
||||
if (!config) {
|
||||
@@ -162,6 +167,10 @@ export function getAzureAuthenticationLibraryConfig(): string {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves configuration `mssql:enableSqlAuthenticationProvider` from settings file.
|
||||
* @returns true if setting is enabled in ADS, false otherwise.
|
||||
*/
|
||||
export function getEnableSqlAuthenticationProviderConfig(): boolean {
|
||||
const config = getConfiguration();
|
||||
if (config) {
|
||||
@@ -172,6 +181,21 @@ export function getEnableSqlAuthenticationProviderConfig(): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves configuration `mssql:enableConnectionPooling` from settings file.
|
||||
* @returns true if setting is enabled in ADS or running ADS in dev mode.
|
||||
*/
|
||||
export function getEnableConnectionPoolingConfig(): boolean {
|
||||
const config = getConfiguration();
|
||||
if (config) {
|
||||
const setting = config.inspect(enableConnectionPoolingConfig);
|
||||
return (azdata.env.quality === azdata.env.AppQuality.dev && setting?.globalValue === undefined && setting?.workspaceValue === undefined) ? true : config[enableConnectionPoolingConfig];
|
||||
}
|
||||
else {
|
||||
return false; // disabled by default
|
||||
}
|
||||
}
|
||||
|
||||
export function getLogFileName(prefix: string, pid: number): string {
|
||||
return `${prefix}_${pid}.log`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user