Added data points for Table Designer (#18182)

* added server infor and metrics for table designer

* update generate script

* pr comments

* format more files

* pr comments

* make changes to core

* remove unused imports

* add server info

* revert enum change and add publish event

* format doc

* nitpicks

* remove os version

* remove modifier from telemetry info

* remove error message
This commit is contained in:
Aditya Bist
2022-02-02 12:40:05 -08:00
committed by GitHub
parent de1a0f4f0f
commit de5090e47a
14 changed files with 117 additions and 19 deletions

View File

@@ -65,6 +65,10 @@ export enum MssqlClusterItemsSubType {
Spark = ':spark:'
}
export enum TableType {
Basic = 'basic'
}
// SPARK JOB SUBMISSION //////////////////////////////////////////////////////////
export const mssqlClusterNewNotebookTask = 'mssqlCluster.task.newNotebook';
export const mssqlClusterOpenNotebookTask = 'mssqlCluster.task.openNotebook';

View File

@@ -6,7 +6,6 @@
// This is the place for extensions to expose APIs.
import * as azdata from 'azdata';
import * as vscode from 'vscode';
/**
* Covers defining what the mssql extension exports to other extensions

View File

@@ -8,17 +8,21 @@ import * as azdata from 'azdata';
import * as vscode from 'vscode';
import { sqlProviderName } from '../constants';
import { generateUuid } from 'vscode-languageclient/lib/utils/uuid';
import { ITelemetryEventProperties, Telemetry } from '../telemetry';
export function registerTableDesignerCommands(appContext: AppContext) {
appContext.extensionContext.subscriptions.push(vscode.commands.registerCommand('mssql.newTable', async (context: azdata.ObjectExplorerContext) => {
const connectionString = await azdata.connection.getConnectionString(context.connectionProfile.id, true);
const serverInfo = await azdata.connection.getServerInfo(context.connectionProfile.id);
let telemetryInfo: ITelemetryEventProperties = {};
telemetryInfo = Telemetry.fillServerInfo(telemetryInfo, serverInfo);
await azdata.designers.openTableDesigner(sqlProviderName, {
server: context.connectionProfile.serverName,
database: context.connectionProfile.databaseName,
isNewTable: true,
id: generateUuid(),
connectionString: connectionString
});
}, telemetryInfo);
}));
appContext.extensionContext.subscriptions.push(vscode.commands.registerCommand('mssql.designTable', async (context: azdata.ObjectExplorerContext) => {
@@ -28,6 +32,9 @@ export function registerTableDesignerCommands(appContext: AppContext) {
const name = context.nodeInfo.metadata.name;
const connectionString = await azdata.connection.getConnectionString(context.connectionProfile.id, true);
const connectionUri = await azdata.connection.getUriForConnection(context.connectionProfile.id);
const serverInfo = await azdata.connection.getServerInfo(context.connectionProfile.id);
let telemetryInfo: ITelemetryEventProperties = {};
telemetryInfo = Telemetry.fillServerInfo(telemetryInfo, serverInfo);
await azdata.designers.openTableDesigner(sqlProviderName, {
server: server,
database: database,
@@ -36,6 +43,6 @@ export function registerTableDesignerCommands(appContext: AppContext) {
schema: schema,
id: `${connectionUri}|${database}|${schema}|${name}`,
connectionString: connectionString
});
}, telemetryInfo);
}));
}

View File

@@ -10,6 +10,8 @@ import { ErrorAction, ErrorHandler, Message, CloseAction } from 'vscode-language
import * as Utils from './utils';
import * as Constants from './constants';
import * as nls from 'vscode-nls';
import { ServerInfo } from 'azdata';
const localize = nls.loadMessageBundle();
const packageJson = require('../package.json');
@@ -114,6 +116,20 @@ export class Telemetry {
}
}
/**
* Collects server information from ServerInfo to put into a
* property bag
*/
public static fillServerInfo(telemetryInfo: { [key: string]: string }, serverInfo: ServerInfo): { [key: string]: string } {
telemetryInfo['serverEdition'] = serverInfo?.serverEdition;
telemetryInfo['serverLevel'] = serverInfo?.serverLevel;
telemetryInfo['serverMajorVersion'] = serverInfo?.serverMajorVersion.toString();
telemetryInfo['serverMinorVersion'] = serverInfo?.serverMinorVersion.toString();
telemetryInfo['isCloud'] = serverInfo?.isCloud.toString();
telemetryInfo['tableType'] = Constants.TableType.Basic;
return telemetryInfo;
}
}
/**