mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 17:23:05 -05:00
Update connection event properties (#14608)
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IAdsTelemetryService, ITelemetryInfo, ITelemetryEvent, ITelemetryConnectionInfo, ITelemetryEventMeasures, ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
|
||||
import * as azdata from 'azdata';
|
||||
import { IAdsTelemetryService, ITelemetryInfo, ITelemetryEvent, ITelemetryEventMeasures, ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
@@ -43,13 +44,23 @@ class TelemetryEventImpl implements ITelemetryEvent {
|
||||
return this;
|
||||
}
|
||||
|
||||
public withConnectionInfo(connectionInfo: ITelemetryConnectionInfo): ITelemetryEvent {
|
||||
public withConnectionInfo(connectionInfo?: azdata.IConnectionProfile): ITelemetryEvent {
|
||||
assign(this._properties,
|
||||
{
|
||||
authenticationType: connectionInfo.authenticationType,
|
||||
providerName: connectionInfo.providerName,
|
||||
serverType: connectionInfo.serverType,
|
||||
engineType: connectionInfo.engineType
|
||||
authenticationType: connectionInfo?.authenticationType,
|
||||
providerName: connectionInfo?.providerName
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
public withServerInfo(serverInfo?: azdata.ServerInfo): ITelemetryEvent {
|
||||
assign(this._properties,
|
||||
{
|
||||
connectionType: serverInfo?.isCloud !== undefined ? (serverInfo.isCloud ? 'Azure' : 'Standalone') : '',
|
||||
serverVersion: serverInfo?.serverVersion ?? '',
|
||||
serverEdition: serverInfo?.serverEdition ?? '',
|
||||
serverEngineEdition: serverInfo?.engineEditionId ?? '',
|
||||
isBigDataCluster: serverInfo?.options?.isBigDataCluster ?? false,
|
||||
});
|
||||
return this;
|
||||
}
|
||||
@@ -64,7 +75,9 @@ class NullTelemetryEventImpl implements ITelemetryEvent {
|
||||
|
||||
public withAdditionalMeasurements(additionalMeasurements: ITelemetryEventMeasures): ITelemetryEvent { return this; }
|
||||
|
||||
public withConnectionInfo(connectionInfo: ITelemetryConnectionInfo): ITelemetryEvent { return this; }
|
||||
public withConnectionInfo(connectionInfo: azdata.IConnectionProfile): ITelemetryEvent { return this; }
|
||||
|
||||
public withServerInfo(serverInfo: azdata.ServerInfo): ITelemetryEvent { return this; }
|
||||
}
|
||||
|
||||
export class AdsTelemetryService implements IAdsTelemetryService {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export const IAdsTelemetryService = createDecorator<IAdsTelemetryService>('adsTelemetryService');
|
||||
@@ -21,16 +22,6 @@ export interface ITelemetryEventMeasures {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connection info properties to add into an event.
|
||||
*/
|
||||
export interface ITelemetryConnectionInfo {
|
||||
authenticationType?: string;
|
||||
providerName?: string;
|
||||
serverType?: string;
|
||||
engineType?: string;
|
||||
}
|
||||
|
||||
export interface ITelemetryEvent {
|
||||
/**
|
||||
* Sends the event
|
||||
@@ -51,9 +42,15 @@ export interface ITelemetryEvent {
|
||||
|
||||
/**
|
||||
* Adds additional connection-related information to this event.
|
||||
* @param connectionInfo The connection info to add. Only the fields in TelemetryConnectionInfo are included, all others are ignored.
|
||||
* @param connectionInfo The connection info to add.
|
||||
*/
|
||||
withConnectionInfo(connectionInfo: ITelemetryConnectionInfo): ITelemetryEvent;
|
||||
withConnectionInfo(connectionInfo?: azdata.IConnectionProfile): ITelemetryEvent;
|
||||
|
||||
/**
|
||||
* Adds additional server-related information to this event.
|
||||
* @param serverInfo The server info to add.
|
||||
*/
|
||||
withServerInfo(serverInfo?: azdata.ServerInfo): ITelemetryEvent;
|
||||
}
|
||||
|
||||
export interface ITelemetryInfo {
|
||||
|
||||
Reference in New Issue
Block a user