Send telemetry action event when user selects 'Enable Trust Server Certificate' (#21113)

This commit is contained in:
Cheena Malhotra
2022-11-04 17:05:32 -07:00
committed by GitHub
parent 00b797b4f3
commit a1f5b403db
3 changed files with 8 additions and 1 deletions

View File

@@ -27,6 +27,8 @@ import * as types from 'vs/base/common/types';
import { trim } from 'vs/base/common/strings';
import { localize } from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import { CmsConnectionController } from 'sql/workbench/services/connection/browser/cmsConnectionController';
import { entries } from 'sql/base/common/collections';
import { onUnexpectedError } from 'vs/base/common/errors';
@@ -89,6 +91,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
@IClipboardService private _clipboardService: IClipboardService,
@ICommandService private _commandService: ICommandService,
@ILogService private _logService: ILogService,
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService
) {
this.initializeConnectionProviders();
}
@@ -524,6 +527,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
Note: A self-signed certificate offers only limited protection and is not a recommended practice for production environments. Do you want to enable 'Trust server certificate' on this connection and retry? `);
let readMoreLink = "https://learn.microsoft.com/sql/database-engine/configure-windows/enable-encrypted-connections-to-the-database-engine"
actions.push(new Action('trustServerCert', enableTrustServerCert, undefined, true, async () => {
this._telemetryService.sendActionEvent(TelemetryKeys.TelemetryView.ConnectionDialog, TelemetryKeys.TelemetryAction.EnableTrustServerCertificate);
this._model.options[Constants.trustServerCertificate] = true;
await this.handleOnConnect(this._connectionDialog.newConnectionParams, this._model as IConnectionProfile);
return;

View File

@@ -108,8 +108,10 @@ suite('ConnectionDialogService tests', () => {
testInstantiationService.stub(ICapabilitiesService, new TestCapabilitiesService());
let logService: ILogService = new NullLogService();
let telemetryService: IAdsTelemetryService = new NullAdsTelemetryService();
connectionDialogService = new ConnectionDialogService(testInstantiationService, capabilitiesService, errorMessageService.object,
new TestConfigurationService(), new BrowserClipboardService(layoutService, logService), NullCommandService, logService);
new TestConfigurationService(), new BrowserClipboardService(layoutService, logService), NullCommandService, logService, telemetryService);
(connectionDialogService as any)._connectionManagementService = mockConnectionManagementService.object;
let providerDisplayNames = ['Mock SQL Server'];
let providerNameToDisplayMap = { 'MSSQL': 'Mock SQL Server' };