mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Support enabling connection pooling (on demand) + additional telemetry (#23664)
This commit is contained in:
@@ -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