mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
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:
@@ -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';
|
||||
|
||||
1
extensions/mssql/src/mssql.d.ts
vendored
1
extensions/mssql/src/mssql.d.ts
vendored
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user