mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
Remove TelemetryUtils and use IAdsTelemetryService directly (#8289)
* Remove TelemetryUtils and use IAdsTelemetryService directly * Fix event names and cleanup * Fix tests * Fix strict null check
This commit is contained in:
@@ -23,7 +23,6 @@ import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { ICancelableEvent } from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { localize } from 'vs/nls';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
@@ -37,6 +36,7 @@ import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
export interface OnShowUIResponse {
|
||||
selectedProviderDisplayName: string;
|
||||
@@ -92,7 +92,7 @@ export class ConnectionDialogWidget extends Modal {
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IContextMenuService private _contextMenuService: IContextMenuService,
|
||||
@IContextViewService private _contextViewService: IContextViewService,
|
||||
|
||||
@@ -20,7 +20,6 @@ import { ConnectionStatusManager } from 'sql/platform/connection/common/connecti
|
||||
import { DashboardInput } from 'sql/workbench/parts/dashboard/browser/dashboardInput';
|
||||
import { ConnectionGlobalStatus } from 'sql/workbench/parts/connection/common/connectionGlobalStatus';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import * as TelemetryUtils from 'sql/platform/telemetry/common/telemetryUtilities';
|
||||
import { IResourceProviderService } from 'sql/workbench/services/resourceProvider/common/resourceProviderService';
|
||||
import { IAngularEventingService, AngularEventType } from 'sql/platform/angularEventing/browser/angularEventingService';
|
||||
import * as QueryConstants from 'sql/workbench/parts/query/common/constants';
|
||||
@@ -37,7 +36,6 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as platform from 'vs/platform/registry/common/platform';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ConnectionProfileGroup, IConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||
@@ -53,6 +51,7 @@ import { entries } from 'sql/base/common/collections';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
export class ConnectionManagementService extends Disposable implements IConnectionManagementService {
|
||||
|
||||
@@ -80,7 +79,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
@IConnectionDialogService private _connectionDialogService: IConnectionDialogService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@ITelemetryService private _telemetryService: ITelemetryService,
|
||||
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
|
||||
@IQuickInputService private _quickInputService: IQuickInputService,
|
||||
@@ -590,7 +589,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
}
|
||||
|
||||
public saveProfileGroup(profile: IConnectionProfileGroup): Promise<string> {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this._logService, TelemetryKeys.AddServerGroup).catch((e) => this._logService.error(e));
|
||||
this._telemetryService.sendActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.AddServerGroup);
|
||||
return this._connectionStore.saveProfileGroup(profile).then(groupId => {
|
||||
this._onAddConnectionProfile.fire(undefined);
|
||||
return groupId;
|
||||
@@ -829,21 +828,25 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
}
|
||||
|
||||
private addTelemetryForConnection(connection: ConnectionManagementInfo): void {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this._logService, TelemetryKeys.DatabaseConnected, {
|
||||
connectionType: connection.serverInfo ? (connection.serverInfo.isCloud ? 'Azure' : 'Standalone') : '',
|
||||
provider: connection.connectionProfile.providerName,
|
||||
serverVersion: connection.serverInfo ? connection.serverInfo.serverVersion : '',
|
||||
serverEdition: connection.serverInfo ? connection.serverInfo.serverEdition : '',
|
||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.DatabaseConnected)
|
||||
.withAdditionalProperties({
|
||||
connectionType: connection.serverInfo ? (connection.serverInfo.isCloud ? 'Azure' : 'Standalone') : '',
|
||||
provider: connection.connectionProfile.providerName,
|
||||
serverVersion: connection.serverInfo ? connection.serverInfo.serverVersion : '',
|
||||
serverEdition: connection.serverInfo ? connection.serverInfo.serverEdition : '',
|
||||
|
||||
extensionConnectionTime: connection.extensionTimer.elapsed() - connection.serviceTimer.elapsed(),
|
||||
serviceConnectionTime: connection.serviceTimer.elapsed()
|
||||
}).catch((e) => this._logService.error(e));
|
||||
extensionConnectionTime: connection.extensionTimer.elapsed() - connection.serviceTimer.elapsed(),
|
||||
serviceConnectionTime: connection.serviceTimer.elapsed()
|
||||
})
|
||||
.send();
|
||||
}
|
||||
|
||||
private addTelemetryForConnectionDisconnected(connection: interfaces.IConnectionProfile): void {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this._logService, TelemetryKeys.DatabaseDisconnected, {
|
||||
provider: connection.providerName
|
||||
}).catch((e) => this._logService.error(e));
|
||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.DatabaseDisconnected)
|
||||
.withAdditionalProperties({
|
||||
provider: connection.providerName
|
||||
})
|
||||
.send();
|
||||
}
|
||||
|
||||
public onConnectionComplete(handle: number, info: azdata.ConnectionInfoSummary): void {
|
||||
@@ -885,13 +888,13 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
}
|
||||
|
||||
public changeGroupIdForConnectionGroup(source: ConnectionProfileGroup, target: ConnectionProfileGroup): Promise<void> {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this._logService, TelemetryKeys.MoveServerConnection).catch((e) => this._logService.error(e));
|
||||
this._telemetryService.sendActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.MoveServerConnection);
|
||||
return this._connectionStore.changeGroupIdForConnectionGroup(source, target);
|
||||
}
|
||||
|
||||
public changeGroupIdForConnection(source: ConnectionProfile, targetGroupId: string): Promise<void> {
|
||||
let id = Utils.generateUri(source);
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this._logService, TelemetryKeys.MoveServerGroup).catch((e) => this._logService.error(e));
|
||||
this._telemetryService.sendActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.MoveServerGroup);
|
||||
return this._connectionStore.changeGroupIdForConnection(source, targetGroupId).then(result => {
|
||||
if (id && targetGroupId) {
|
||||
source.groupId = targetGroupId;
|
||||
@@ -1146,8 +1149,10 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
* Disconnects a connection before removing from settings.
|
||||
*/
|
||||
public deleteConnection(connection: ConnectionProfile): Promise<boolean> {
|
||||
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this._logService, TelemetryKeys.DeleteConnection, {}, connection).catch((e) => this._logService.error(e));
|
||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.DeleteConnection)
|
||||
.withAdditionalProperties({
|
||||
provider: connection.providerName
|
||||
}).send();
|
||||
// Disconnect if connected
|
||||
let uri = Utils.generateUri(connection);
|
||||
if (this.isConnected(uri) || this.isConnecting(uri)) {
|
||||
@@ -1177,7 +1182,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
* Disconnects a connection before removing from config. If disconnect fails, settings is not modified.
|
||||
*/
|
||||
public deleteConnectionGroup(group: ConnectionProfileGroup): Promise<boolean> {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this._logService, TelemetryKeys.DeleteServerGroup).catch((e) => this._logService.error(e));
|
||||
this._telemetryService.sendActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.DeleteServerGroup);
|
||||
// Get all connections for this group
|
||||
let connections = ConnectionProfileGroup.getConnectionsInGroup(group);
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import { TestNotificationService } from 'vs/platform/notification/test/common/te
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { NullAdsTelemetryService } from 'sql/platform/telemetry/common/adsTelemetryService';
|
||||
|
||||
suite('SQL ConnectionManagementService tests', () => {
|
||||
|
||||
@@ -152,7 +153,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
connectionDialogService.object,
|
||||
undefined, // IInstantiationService
|
||||
workbenchEditorService.object,
|
||||
undefined, // ITelemetryService
|
||||
new NullAdsTelemetryService(), // ITelemetryService
|
||||
workspaceConfigurationServiceMock.object,
|
||||
capabilitiesService,
|
||||
undefined, // IQuickInputService
|
||||
|
||||
@@ -12,7 +12,6 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IListVirtualDelegate, IListRenderer } from 'vs/base/browser/ui/list/list';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
@@ -28,6 +27,7 @@ import { IClipboardService } from 'sql/platform/clipboard/common/clipboardServic
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
class ExtensionListDelegate implements IListVirtualDelegate<IDashboardUITab> {
|
||||
|
||||
@@ -110,7 +110,7 @@ export class NewDashboardTabDialog extends Modal {
|
||||
constructor(
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@ILogService logService: ILogService,
|
||||
|
||||
@@ -10,7 +10,6 @@ import { Dialog, DialogButton } from 'sql/workbench/services/dialog/common/dialo
|
||||
import { DialogPane } from 'sql/workbench/services/dialog/browser/dialogPane';
|
||||
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
|
||||
import { Button } from 'vs/base/browser/ui/button/button';
|
||||
@@ -24,6 +23,7 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
|
||||
import { append, $ } from 'vs/base/browser/dom';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
export class DialogModal extends Modal {
|
||||
private _dialogPane: DialogPane;
|
||||
@@ -39,7 +39,7 @@ export class DialogModal extends Modal {
|
||||
options: IModalOptions,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@ILogService logService: ILogService,
|
||||
|
||||
@@ -13,7 +13,6 @@ import { DialogMessage } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { DialogModule } from 'sql/workbench/services/dialog/browser/dialog.module';
|
||||
import { Button } from 'vs/base/browser/ui/button/button';
|
||||
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
@@ -25,6 +24,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
export class WizardModal extends Modal {
|
||||
private _dialogPanes = new Map<WizardPage, DialogPane>();
|
||||
@@ -47,7 +47,7 @@ export class WizardModal extends Modal {
|
||||
options: IModalOptions,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
|
||||
@@ -14,7 +14,6 @@ import Severity from 'vs/base/common/severity';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND } from 'vs/workbench/common/theme';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { localize } from 'vs/nls';
|
||||
@@ -23,6 +22,7 @@ import * as DOM from 'vs/base/browser/dom';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
const maxActions = 1;
|
||||
|
||||
@@ -46,7 +46,7 @@ export class ErrorMessageDialog extends Modal {
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@ILogService logService: ILogService,
|
||||
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService
|
||||
|
||||
@@ -22,7 +22,6 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
@@ -32,6 +31,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
export class FileBrowserDialog extends Modal {
|
||||
private _viewModel: FileBrowserViewModel;
|
||||
@@ -53,7 +53,7 @@ export class FileBrowserDialog extends Modal {
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IContextViewService private _contextViewService: IContextViewService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@ILogService logService: ILogService,
|
||||
|
||||
@@ -26,7 +26,6 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
@@ -42,6 +41,7 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
|
||||
import { IInsightsConfigDetails } from 'sql/platform/dashboard/browser/insightRegistry';
|
||||
import { TaskRegistry } from 'sql/platform/tasks/browser/tasksRegistry';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
const labelDisplay = nls.localize("insights.item", "Item");
|
||||
const valueDisplay = nls.localize("insights.value", "Value");
|
||||
@@ -162,7 +162,7 @@ export class InsightsDialogView extends Modal {
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@ILogService logService: ILogService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
|
||||
@@ -13,8 +13,6 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import * as TelemetryUtils from 'sql/platform/telemetry/common/telemetryUtilities';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ServerTreeView } from 'sql/workbench/parts/objectExplorer/browser/serverTreeView';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import * as Utils from 'sql/platform/connection/common/utils';
|
||||
@@ -22,6 +20,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { entries } from 'sql/base/common/collections';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
export const SERVICE_ID = 'ObjectExplorerService';
|
||||
|
||||
@@ -146,7 +145,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@ITelemetryService private _telemetryService: ITelemetryService,
|
||||
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
|
||||
@ILogService private logService: ILogService
|
||||
) {
|
||||
@@ -348,7 +347,11 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
return new Promise<azdata.ObjectExplorerExpandInfo>((resolve, reject) => {
|
||||
let provider = this._providers[providerId];
|
||||
if (provider) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.ObjectExplorerExpand, { refresh: 0, provider: providerId }).catch((e) => this.logService.error(e));
|
||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ObjectExplorerExpand)
|
||||
.withAdditionalProperties({
|
||||
refresh: false,
|
||||
provider: providerId
|
||||
}).send();
|
||||
this.expandOrRefreshNode(providerId, session, nodePath).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
@@ -486,7 +489,11 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
public refreshNode(providerId: string, session: azdata.ObjectExplorerSession, nodePath: string): Thenable<azdata.ObjectExplorerExpandInfo> {
|
||||
let provider = this._providers[providerId];
|
||||
if (provider) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.ObjectExplorerExpand, { refresh: 1, provider: providerId }).catch((e) => this.logService.error(e));
|
||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ObjectExplorerExpand)
|
||||
.withAdditionalProperties({
|
||||
refresh: true,
|
||||
provider: providerId
|
||||
}).send();
|
||||
return this.expandOrRefreshNode(providerId, session, nodePath, true);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
|
||||
@@ -21,6 +21,7 @@ import { TestObjectExplorerProvider } from 'sql/workbench/services/objectExplore
|
||||
import { TestConnectionManagementService } from 'sql/platform/connection/test/common/testConnectionManagementService';
|
||||
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { NullAdsTelemetryService } from 'sql/platform/telemetry/common/adsTelemetryService';
|
||||
|
||||
suite('SQL Object Explorer Service tests', () => {
|
||||
let sqlOEProvider: TypeMoq.Mock<TestObjectExplorerProvider>;
|
||||
@@ -265,7 +266,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
connectionManagementService.setup(x => x.getCapabilities(mssqlProviderName)).returns(() => undefined);
|
||||
|
||||
const logService = new NullLogService();
|
||||
objectExplorerService = new ObjectExplorerService(connectionManagementService.object, undefined, capabilitiesService, logService);
|
||||
objectExplorerService = new ObjectExplorerService(connectionManagementService.object, new NullAdsTelemetryService(), capabilitiesService, logService);
|
||||
objectExplorerService.registerProvider(mssqlProviderName, sqlOEProvider.object);
|
||||
sqlOEProvider.setup(x => x.createNewSession(TypeMoq.It.is<azdata.ConnectionInfo>(x => x.options['serverName'] === connection.serverName))).returns(() => new Promise<any>((resolve) => {
|
||||
resolve(response);
|
||||
|
||||
@@ -3,18 +3,16 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { IResourceProviderService, IHandleFirewallRuleResult } from 'sql/workbench/services/resourceProvider/common/resourceProviderService';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import * as TelemetryUtils from 'sql/platform/telemetry/common/telemetryUtilities';
|
||||
import { FirewallRuleDialogController } from 'sql/workbench/parts/accounts/browser/firewallRuleDialogController';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { invalidProvider } from 'sql/base/common/errors';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
export class ResourceProviderService implements IResourceProviderService {
|
||||
|
||||
@@ -23,9 +21,8 @@ export class ResourceProviderService implements IResourceProviderService {
|
||||
private _firewallRuleDialogController: FirewallRuleDialogController;
|
||||
|
||||
constructor(
|
||||
@ITelemetryService private _telemetryService: ITelemetryService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -49,7 +46,10 @@ export class ResourceProviderService implements IResourceProviderService {
|
||||
return new Promise<azdata.CreateFirewallRuleResponse>((resolve, reject) => {
|
||||
const provider = this._providers[resourceProviderId];
|
||||
if (provider) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.FirewallRuleRequested, { provider: resourceProviderId });
|
||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.FirewallRuleRequested)
|
||||
.withAdditionalProperties({
|
||||
provider: resourceProviderId
|
||||
}).send();
|
||||
provider.createFirewallRule(selectedAccount, firewallruleInfo).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
|
||||
Reference in New Issue
Block a user