mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 09:35:36 -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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user