From c8b775034a39020a1741c855ee5dee000cb63bf5 Mon Sep 17 00:00:00 2001 From: ecmel Date: Wed, 17 Dec 2025 23:13:09 +0300 Subject: [PATCH 1/2] update telemetry data --- CHANGELOG.md | 26 ++++ ref_card.md | 141 ++++++++++++++++-- server/src/qLangServer.ts | 43 +++++- src/classes/insightsConnection.ts | 9 +- src/commands/dataSourceCommand.ts | 4 +- src/commands/serverCommand.ts | 37 ++--- src/commands/setupCommand.ts | 14 +- src/commands/workspaceCommand.ts | 41 ++++- src/extension.ts | 18 +-- src/services/connectionManagerService.ts | 38 ++--- src/services/dataSourceEditorProvider.ts | 25 ++++ src/services/notebookController.ts | 13 ++ src/utils/connLabel.ts | 28 +--- src/utils/core.ts | 2 +- src/utils/dataSource.ts | 5 +- src/utils/feedbackSurveyUtils.ts | 2 +- src/utils/queryUtils.ts | 37 +++++ src/utils/workspace.ts | 22 +-- test/suite/server/qLangServer.test.ts | 7 +- .../connectionManagementService.test.ts | 2 - .../notebook/notebookController.test.ts | 15 +- test/suite/utils/connLabel.test.ts | 43 ------ 22 files changed, 369 insertions(+), 203 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 179d7909..d349ec4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,32 @@ All notable changes to the **kdb VS Code extension** are documented in this file. +# v1.17.0 + +### Enhancements + +- Added quick connections +- Run on REPL by default +- SQL Workbook +- Connect and auto execute query functionality +- Use own grid instead of ag-grid-community for kdb Results View +- Add support for KDB-X modules in language server +- Moved documentation to its own site + +### Fixes + +- kdb output channel should support log levels +- CSV export does not work properly for cells that contain lists or strings +- Auto resizing of grid columns +- Specific python query executions not working + +### Internal Improvements + +- Updated telemetry data sent +- Use structured text for datasources +- Integrate KDB-X KX_TTY feature in REPL +- Update query wrappers and added q CI testing + # v1.16.1 ### Fixes diff --git a/ref_card.md b/ref_card.md index e194c631..3b8e5d48 100644 --- a/ref_card.md +++ b/ref_card.md @@ -57,14 +57,137 @@ ## Execution -| Type | REPL | My q | IE SP | IE q/SQL | IE API | IE UDA | IE Populate SP | -| :--------- | :--: | :--: | :---: | :------: | :----: | :----: | :------------: | -| File `q` | ✓ | ✓ | ✓ | ✓ | | | ✓ | -| File `py` | ✓ | ✓ | ✓ | ✓ | | | ✓ | -| File `sql` | ✓ | ✓ | | ✓ | | | ✓ | -| Cell `q` | ✓ | ✓ | ✓ | ✓ | | | ✓ | -| Cell `py` | ✓ | ✓ | ✓ | ✓ | | | ✓ | -| Cell `sql` | ✓ | ✓ | | ✓ | | | ✓ | -| Datasource | | | | ✓ | ✓ | ✓ | ✓ | +| Type | REPL | My q | IE SP | IE q/SQL | IE API | IE UDA | IE Populate SP | +| :------------------ | :--: | :--: | :---: | :------: | :----: | :----: | :------------: | +| File `q` | ✓ | ✓ | ✓ | ✓ | | | ✓ | +| File `py` | ✓ | ✓ | ✓ | ✓ | | | ✓ | +| File `sql` | ✓ | ✓ | | ✓ | | | ✓ | +| Workbook `q` | ✓ | ✓ | ✓ | ✓ | | | ✓ | +| Workbook `py` | ✓ | ✓ | ✓ | ✓ | | | ✓ | +| Workbook `sql` | ✓ | ✓ | | ✓ | | | ✓ | +| Notebook Cell `q` | ✓ | ✓ | ✓ | ✓ | | | ✓ | +| Notebook Cell `py` | ✓ | ✓ | ✓ | ✓ | | | ✓ | +| Notebook Cell `sql` | ✓ | ✓ | | ✓ | | | ✓ | +| Datasource | | | | ✓ | ✓ | ✓ | ✓ | `REPL` and `My q` requires [PyKX](https://github.com/KxSystems/kx-vscode/wiki/Use-PyKX-Within-REPL) for Python support. + +## Telemetry + +| Telemetry | Measurements | Source | +| :------------------------------- | :----------: | :--------------------------------------- | +| Extension.Activated | | src/extension.ts | +| Extension.CustomAuth.Activated | | src/extension.ts | +| ¦ | | | +| Welcome.Displayed | | src/commands/setupCommand.ts | +| Install.kdbx | | src/commands/setupCommand.ts | +| Install.kdbx.workspace | | src/commands/setupCommand.ts | +| Install.kdbx.win32.fail | | src/commands/setupCommand.ts | +| Repl.Start | | src/commands/workspaceCommand.ts | +| ¦ | | | +| Connection.Create.kdb | | src/commands/serverCommand.ts | +| Connection.Edit.kdb | | src/commands/serverCommand.ts | +| Connection.Delete.kdb | | src/services/connectionManagerService.ts | +| Connection.Create.ie | | src/commands/serverCommand.ts | +| Connection.Edit.ie | | src/commands/serverCommand.ts | +| Connection.Delete.ie | | src/services/connectionManagerService.ts | +| Connection.Export.All | | src/extension.ts | +| Connection.Export.Single | | src/extension.ts | +| Connection.Import | | src/extension.ts | +| Connection.Reset.ie.sp | | src/classes/insightsConnection.ts | +| Connection.Label.Create | ✓ | src/utils/connLabel.ts | +| Connection.Label.Assign | ✓ | src/utils/connLabel.ts | +| Connection.Label.Unassign | ✓ | src/utils/connLabel.ts | +| Connection.Label.Delete | ✓ | src/utils/connLabel.ts | +| ¦ | | | +| Run.Workbook.repl.q | | src/utils/queryUtils.ts | +| Run.Workbook.repl.py | | src/utils/queryUtils.ts | +| Run.Workbook.repl.sql | | src/utils/queryUtils.ts | +| Run.File.repl.q | | src/utils/queryUtils.ts | +| Run.File.repl.py | | src/utils/queryUtils.ts | +| Run.File.repl.sql | | src/utils/queryUtils.ts | +| Run.Cell.repl.q | | src/utils/queryUtils.ts | +| Run.Cell.repl.py | | src/utils/queryUtils.ts | +| Run.Cell.repl.sql | | src/utils/queryUtils.ts | +| ¦ | | | +| Run.Workbook.kdb.q | | src/utils/queryUtils.ts | +| Run.Workbook.kdb.py | | src/utils/queryUtils.ts | +| Run.Workbook.kdb.sql | | src/utils/queryUtils.ts | +| Run.File.kdb.q | | src/utils/queryUtils.ts | +| Run.File.kdb.py | | src/utils/queryUtils.ts | +| Run.File.kdb.sql | | src/utils/queryUtils.ts | +| Run.Cell.kdb.q | | src/utils/queryUtils.ts | +| Run.Cell.kdb.py | | src/utils/queryUtils.ts | +| Run.Cell.kdb.sql | | src/utils/queryUtils.ts | +| ¦ | | | +| Run.Workbook.ie.q | | src/utils/queryUtils.ts | +| Run.Workbook.ie.py | | src/utils/queryUtils.ts | +| Run.Workbook.ie.sql | | src/utils/queryUtils.ts | +| Run.File.ie.q | | src/utils/queryUtils.ts | +| Run.File.ie.py | | src/utils/queryUtils.ts | +| Run.File.ie.sql | | src/utils/queryUtils.ts | +| Run.Cell.ie.q | | src/utils/queryUtils.ts | +| Run.Cell.ie.py | | src/utils/queryUtils.ts | +| Run.Cell.ie.sql | | src/utils/queryUtils.ts | +| ¦ | | | +| Run.Workbook.ie.dap.q | | src/utils/queryUtils.ts | +| Run.Workbook.ie.dap.py | | src/utils/queryUtils.ts | +| Run.File.ie.dap.q | | src/utils/queryUtils.ts | +| Run.File.ie.dap.py | | src/utils/queryUtils.ts | +| Run.Cell.ie.dap.q | | src/utils/queryUtils.ts | +| Run.Cell.ie.dap.py | | src/utils/queryUtils.ts | +| ¦ | | | +| Run.Workbook.kdb.quick.q | | | +| Run.Workbook.kdb.quick.py | | | +| Run.Workbook.kdb.quick.sql | | | +| Run.File.kdb.quick.q | | | +| Run.File.kdb.quick.py | | | +| Run.File.kdb.quick.sql | | | +| Run.Cell.kdb.quick.q | | | +| Run.Cell.kdb.quick.py | | | +| Run.Cell.kdb.quick.sql | | | +| ¦ | | | +| Run.Datasource.api | | src/utils/queryUtils.ts | +| Run.Datasource.q | | src/utils/queryUtils.ts | +| Run.Datasource.sql | | src/utils/queryUtils.ts | +| Run.Datasource.uda | | src/utils/queryUtils.ts | +| ¦ | | | +| Populate.Datasource.api | | src/utils/queryUtils.ts | +| Populate.Datasource.q | | src/utils/queryUtils.ts | +| Populate.Datasource.sql | | src/utils/queryUtils.ts | +| Populate.Datasource.uda | | src/utils/queryUtils.ts | +| ¦ | | | +| Populate.Workbook.q | | src/utils/queryUtils.ts | +| Populate.Workbook.py | | src/utils/queryUtils.ts | +| Populate.Workbook.sql | | src/utils/queryUtils.ts | +| Populate.File.q | | src/utils/queryUtils.ts | +| Populate.File.py | | src/utils/queryUtils.ts | +| Populate.File.sql | | src/utils/queryUtils.ts | +| Populate.Cell.q | | src/utils/queryUtils.ts | +| Populate.Cell.py | | src/utils/queryUtils.ts | +| Populate.Cell.sql | | src/utils/queryUtils.ts | +| ¦ | | | +| Graphics.Displayed.kdb.q | | src/commands/serverCommand.ts | +| Graphics.Displayed.kdb.py | | src/commands/serverCommand.ts | +| Graphics.Displayed.ie.q | | src/commands/serverCommand.ts | +| Graphics.Displayed.ie.py | | src/commands/serverCommand.ts | +| ¦ | | | +| Debugger.Run | | | +| Debugger.Resume | | | +| Debugger.StepOver | | | +| Debugger.SetBreakPoint | | | +| ¦ | | | +| Language.onReferences | | server/src/qLangServer.ts | +| Language.onDefinition | | server/src/qLangServer.ts | +| Language.onCompletion | | server/src/qLangServer.ts | +| Language.onRenameRequest | | server/src/qLangServer.ts | +| Language.onParameterCache | | server/src/qLangServer.ts | +| Language.onFoldingRanges | | server/src/qLangServer.ts | +| Language.onIncomingCallHierarchy | | server/src/qLangServer.ts | +| Language.onOutgoingCallHierarchy | | server/src/qLangServer.ts | +| ¦ | | | +| Help.Open.Documentation | | src/extension.ts | +| Help.Open.ReportBug | | src/extension.ts | +| Help.Open.SuggestFeature | | src/extension.ts | +| Help.Open.Survey | | src/extension.ts | +| Help.Hide.Survey | | src/utils/feedbackSurveyUtils.ts | diff --git a/server/src/qLangServer.ts b/server/src/qLangServer.ts index 6f507f98..1fc9fce8 100644 --- a/server/src/qLangServer.ts +++ b/server/src/qLangServer.ts @@ -199,14 +199,13 @@ export default class QLangServer { options: { logger?: string; params?: any; + telemetry?: string | boolean; } = {}, - telemetry?: string | boolean, ) { this.connection.sendNotification("notify", { message, kind, options, - telemetry, }); } @@ -252,6 +251,11 @@ export default class QLangServer { textDocument: { uri }, position, }: ReferenceParams): Promise { + this.notify("onReferences", MessageKind.DEBUG, { + logger, + telemetry: "Language.onReferences", + }); + const source = await this.getSource(uri); const target = source.tokenAt(position); @@ -271,6 +275,11 @@ export default class QLangServer { textDocument: { uri }, position, }: DefinitionParams): Promise { + this.notify("onDefinition", MessageKind.DEBUG, { + logger, + telemetry: "Language.onDefinition", + }); + const source = await this.getSource(uri); const target = source.tokenAt(position); @@ -291,6 +300,11 @@ export default class QLangServer { position, newName, }: RenameParams): Promise { + this.notify("onRenameRequest", MessageKind.DEBUG, { + logger, + telemetry: "Language.onRenameRequest", + }); + const source = await this.getSource(uri); const target = source.tokenAt(position); @@ -325,6 +339,11 @@ export default class QLangServer { textDocument: { uri }, position, }: CompletionParams): Promise { + this.notify("onCompletion", MessageKind.DEBUG, { + logger, + telemetry: "Language.onCompletion", + }); + const source = await this.getSource(uri); const target = source.tokenAt(position); @@ -373,6 +392,11 @@ export default class QLangServer { textDocument: { uri }, position, }: TextDocumentPositionParams) { + this.notify("onParameterCache", MessageKind.DEBUG, { + logger, + telemetry: "Language.onParameterCache", + }); + const source = await this.getSource(uri); const target = source.tokenAt(position); if (!target) { @@ -427,6 +451,11 @@ export default class QLangServer { public async onFoldingRanges({ textDocument: { uri }, }: FoldingRangeParams): Promise { + this.notify("onFoldingRanges", MessageKind.DEBUG, { + logger, + telemetry: "Language.onFoldingRanges", + }); + const source = await this.getSource(uri); const ranges: FoldingRange[] = []; @@ -504,6 +533,11 @@ export default class QLangServer { public async onIncomingCallsCallHierarchy({ item: { data, uri, name }, }: CallHierarchyIncomingCallsParams): Promise { + this.notify("onIncomingCallHierarchy", MessageKind.DEBUG, { + logger, + telemetry: "Language.onIncomingCallHierarchy", + }); + const incoming: CallHierarchyIncomingCall[] = []; if (!data) return incoming; @@ -533,6 +567,11 @@ export default class QLangServer { public async onOutgoingCallsCallHierarchy({ item: { data, uri, name }, }: CallHierarchyOutgoingCallsParams): Promise { + this.notify("onOutgoingCallHierarchy", MessageKind.DEBUG, { + logger, + telemetry: "Language.onOutgoingCallHierarchy", + }); + const outgoing: CallHierarchyOutgoingCall[] = []; if (!data) return outgoing; diff --git a/src/classes/insightsConnection.ts b/src/classes/insightsConnection.ts index 30a8d14f..b66c7434 100644 --- a/src/classes/insightsConnection.ts +++ b/src/classes/insightsConnection.ts @@ -526,7 +526,6 @@ export class InsightsConnection { params: DataSourceFiles, silent?: boolean, ): Promise { - let dsTypeString = ""; if (this.connected && this.connEndpoints) { let coreUrl: string; const body: any = { @@ -541,13 +540,11 @@ export class InsightsConnection { endTS: convertTimeToTimestamp(params.dataSource.api.endTS), }; coreUrl = this.connEndpoints.scratchpad.import; - dsTypeString = "API"; break; } case DataSourceTypes.SQL: { body.params = { query: params.dataSource.sql.query }; coreUrl = this.connEndpoints.scratchpad.importSql; - dsTypeString = "SQL"; break; } case DataSourceTypes.QSQL: { @@ -558,7 +555,6 @@ export class InsightsConnection { ); coreUrl = this.connEndpoints.scratchpad.importQsql; - dsTypeString = "QSQL"; break; } case DataSourceTypes.UDA: { @@ -613,8 +609,6 @@ export class InsightsConnection { { logger, params: { status: response.status }, - telemetry: - "Datasource." + dsTypeString + ".Scratchpad.Populated.Errored", }, ); } else { @@ -624,7 +618,6 @@ export class InsightsConnection { { logger, params: { status: response.status }, - telemetry: "Datasource." + dsTypeString + ".Scratchpad.Populated", }, ); } @@ -840,7 +833,7 @@ export class InsightsConnection { notify( `Scratchpad reset for ${this.connLabel} executed successfully.`, MessageKind.INFO, - { logger, telemetry: "Scratchpad.Reseted" }, + { logger, telemetry: "Connection.Reset.ie.sp" }, ); return true; }) diff --git a/src/commands/dataSourceCommand.ts b/src/commands/dataSourceCommand.ts index d5d36a96..cc4d33bf 100644 --- a/src/commands/dataSourceCommand.ts +++ b/src/commands/dataSourceCommand.ts @@ -75,7 +75,7 @@ export async function addDataSource(): Promise { notify( `Created ${fileName} in ${kdbDataSourcesFolderPath}.`, MessageKind.INFO, - { logger, telemetry: "Datasource.Created" }, + { logger }, ); } @@ -157,7 +157,6 @@ export async function runDataSource( notify(`Running ${fileContent.name} datasource...`, MessageKind.DEBUG, { logger, - telemetry: "Datasource." + selectedType + ".Run", }); const isNotebook = executorName.endsWith(".kxnb"); @@ -195,7 +194,6 @@ export async function runDataSource( notify("Query execution failed.", MessageKind.DEBUG, { logger, params: res.error, - telemetry: "Datasource." + selectedType + ".Run.Error", }); } if (isNotebook || ext.isResultsTabVisible) { diff --git a/src/commands/serverCommand.ts b/src/commands/serverCommand.ts index a2b45fe8..14ab50ef 100644 --- a/src/commands/serverCommand.ts +++ b/src/commands/serverCommand.ts @@ -173,7 +173,7 @@ export async function addInsightsConnection( ext.serverProvider.refreshInsights(newInsights); notify("Created Insights connection.", MessageKind.DEBUG, { logger, - telemetry: "Connection.Created.Insights", + telemetry: "Connection.Create.ie", }); } @@ -274,7 +274,7 @@ export async function editInsightsConnection( ext.serverProvider.refreshInsights(newInsights); notify("Edited Insights connection.", MessageKind.DEBUG, { logger, - telemetry: "Connection.Edited.Insights", + telemetry: "Connection.Edit.ie", }); if (isConnectedConn) { offerReconnectionAfterEdit(insightsData.alias); @@ -480,7 +480,7 @@ export async function addKdbConnection( } notify("Created kdb connection.", MessageKind.DEBUG, { logger, - telemetry: "Connection.Created.QProcess", + telemetry: "Connection.Create.kdb", }); ext.serverProvider.refresh(newServers); } @@ -603,7 +603,7 @@ export async function editKdbConnection( ext.serverProvider.refresh(newServers); notify("Edited kdb connection.", MessageKind.DEBUG, { logger, - telemetry: "Connection.Edited.KDB", + telemetry: "Connection.Edit.kdb", }); const connLabelToReconn = `${kdbData.serverName}:${kdbData.serverPort} [${kdbData.serverAlias}]`; if (isConnectedConn) { @@ -904,16 +904,10 @@ export async function executeQuery( const selectedConn = connMngService.retrieveConnectedConnection(connLabel); const isInsights = selectedConn instanceof InsightsConnection; const connVersion = isInsights ? (selectedConn.insightsVersion ?? 0) : 0; - const telemetryLangType = isPython ? ".Python" : ".q"; - const telemetryBaseMsg = isWorkbook ? "Workbook" : "Scratchpad"; - notify("Query execution.", MessageKind.DEBUG, { - logger, - telemetry: telemetryBaseMsg + ".Execute" + telemetryLangType, - }); + if (query.length === 0) { notify("Empty query.", MessageKind.DEBUG, { logger, - telemetry: telemetryBaseMsg + ".Execute" + telemetryLangType + ".Error", }); queryConsole.appendQueryError( query, @@ -948,7 +942,7 @@ export async function executeQuery( } // set context for root nodes - if (selectedConn instanceof InsightsConnection) { + if (isInsights) { const res = await writeScratchpadResult( results, query, @@ -971,7 +965,10 @@ export async function executeQuery( if (data) { notify("GG Plot displayed", MessageKind.DEBUG, { logger, - telemetry: "GGPLOT.Display" + (isPython ? ".Python" : ".q"), + telemetry: + "Graphics.Displayed" + + (isInsights ? ".ie" : ".kdb") + + (isPython ? ".py" : ".q"), }); const active = ext.activeTextEditor; if (active) { @@ -1344,18 +1341,11 @@ export async function writeQueryResultsToView( isPython, ); let isSuccess = true; - const telemetryLangType = isPython ? ".Python" : ".q"; - const telemetryBaseMsg = type === "WORKBOOK" ? "Workbook" : "Scratchpad"; if (!checkIfIsDatasource(type)) { if (typeof result === "string") { const res = decodeQUTF(result); if (res.startsWith(queryConstants.error)) { - notify("Telemetry", MessageKind.DEBUG, { - logger, - telemetry: - telemetryBaseMsg + ".Execute" + telemetryLangType + ".Error", - }); isSuccess = false; } } @@ -1385,18 +1375,11 @@ export async function writeScratchpadResult( duration: string, connVersion: number, ): Promise { - const telemetryLangType = isPython ? ".Python" : ".q"; - const telemetryBaseMsg = isWorkbook ? "Workbook" : "Scratchpad"; let errorMsg; if (result.error) { errorMsg = "Error: " + result.errorMsg; - notify("Scratchpad query returned error", MessageKind.DEBUG, { - logger, - telemetry: telemetryBaseMsg + ".Execute" + telemetryLangType + ".Error", - }); - if (result.stacktrace) { errorMsg = errorMsg + diff --git a/src/commands/setupCommand.ts b/src/commands/setupCommand.ts index aa50dc8b..b86947c5 100644 --- a/src/commands/setupCommand.ts +++ b/src/commands/setupCommand.ts @@ -46,6 +46,10 @@ export async function showSetupError(workspace?: vscode.WorkspaceFolder) { export function showWelcome() { /* c8 ignore start */ + notify("Welcome displayed.", MessageKind.DEBUG, { + logger, + telemetry: "Welcome.Displayed", + }); if (panel) { panel.reveal(); } else { @@ -122,7 +126,7 @@ export async function installKdbX() { notify( "KDB-X on Windows requires Windows Subsystem for Linux (WSL). Connect to a WSL instance and try again.", MessageKind.WARNING, - { logger }, + { logger, telemetry: "Install.kdbx.win32.fail" }, ); return; } @@ -249,10 +253,18 @@ async function parseOutput(execution: vscode.TerminalShellExecution) { for (const folder of vscode.workspace.workspaceFolders || []) { if (home.startsWith(folder.uri.fsPath)) { await setHome(vscode.workspace.asRelativePath(home), folder); + notify("KDB-X installed to workspace.", MessageKind.DEBUG, { + logger, + telemetry: "Install.kdbx.workspace", + }); return; } } await setHome(home); + notify("KDB-X installed globally.", MessageKind.DEBUG, { + logger, + telemetry: "Install.kdbx", + }); } /* c8 ignore stop */ } diff --git a/src/commands/workspaceCommand.ts b/src/commands/workspaceCommand.ts index d595a095..7958ff15 100644 --- a/src/commands/workspaceCommand.ts +++ b/src/commands/workspaceCommand.ts @@ -46,7 +46,11 @@ import { notify, Runner, } from "../utils/notifications"; -import { getPythonWrapper, getSQLWrapper } from "../utils/queryUtils"; +import { + getPythonWrapper, + getSQLWrapper, + notifyExecution, +} from "../utils/queryUtils"; import { cleanAssemblyName, cleanDapName, @@ -470,6 +474,10 @@ function isKxFolder(uri: Uri | undefined) { export async function startRepl() { const instance = await ReplConnection.getOrCreateInstance(); instance.start(); + notify("REPL started.", MessageKind.DEBUG, { + logger, + telemetry: "Repl.Start", + }); } export async function runOnRepl(editor: TextEditor, type?: ExecutionTypes) { @@ -532,7 +540,18 @@ export async function runActiveEditor(type?: ExecutionTypes) { await setServerForUri(uri, undefined); } if (server === undefined) { - runOnRepl(ext.activeTextEditor, type); + await runOnRepl(ext.activeTextEditor, type); + notifyExecution( + true, + !!isWorkbook(uri), + false, + true, + false, + false, + false, + !!isPython(uri), + !!isSql(uri), + ); return; } const conn = await findConnection(uri); @@ -543,7 +562,6 @@ export async function runActiveEditor(type?: ExecutionTypes) { const isInsights = conn instanceof InsightsConnection; const executorName = getBasename(ext.activeTextEditor.document.uri); const target = isInsights ? getTargetForUri(uri) : undefined; - const isSql = executorName.endsWith(".sql"); if (type === ExecutionTypes.PopulateScratchpad && !isInsights) { notify( @@ -563,11 +581,22 @@ export async function runActiveEditor(type?: ExecutionTypes) { : type, conn.connLabel, executorName, - !isPython(uri), + !!isWorkbook(uri), undefined, target, - isSql, - conn instanceof InsightsConnection, + !!isSql(uri), + isInsights, + ); + notifyExecution( + type !== ExecutionTypes.PopulateScratchpad, + !!isWorkbook(uri), + false, + false, + isInsights, + !!target, + false, + !!isPython(uri), + !!isSql(uri), ); } catch (error) { notify( diff --git a/src/extension.ts b/src/extension.ts index 74a4b8e2..4d3c5acd 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -298,7 +298,7 @@ export async function activate(context: vscode.ExtensionContext) { context.subscriptions.push( client.onNotification("notify", (params) => - notify(params.message, params.kind, params.options, params.telemetry), + notify(params.message, params.kind, params.options), ), ); @@ -340,7 +340,7 @@ export async function activate(context: vscode.ExtensionContext) { if ("auth" in api) { notify("Custom authentication activated.", MessageKind.DEBUG, { logger, - telemetry: "CustomAuth.Extension.Actived", + telemetry: "Extension.CustomAuth.Activated", }); ext.customAuth = api; } @@ -380,7 +380,7 @@ function registerHelpCommands(): CommandRegistration[] { .then(undefined, () => { notify("Help&Feedback documentation selected.", MessageKind.DEBUG, { logger, - telemetry: "Help&Feedback.Open.ExtensionDocumentation", + telemetry: "Help.Open.Documentation", }); vscode.commands.executeCommand("extension.open", "KX.kdb"); }); @@ -391,7 +391,7 @@ function registerHelpCommands(): CommandRegistration[] { callback: () => { notify("Help&Feedback suggest a feature selected.", MessageKind.DEBUG, { logger, - telemetry: "Help&Feedback.Open.SuggestFeature", + telemetry: "Help.Open.SuggestFeature", }); vscode.env.openExternal(vscode.Uri.parse(ext.urlLinks.suggestFeature)); }, @@ -401,7 +401,7 @@ function registerHelpCommands(): CommandRegistration[] { callback: () => { notify("Help&Feedback survey selected.", MessageKind.DEBUG, { logger, - telemetry: "Help&Feedback.Open.Survey", + telemetry: "Help.Open.Survey", }); vscode.env.openExternal(vscode.Uri.parse(ext.urlLinks.survey)); }, @@ -411,7 +411,7 @@ function registerHelpCommands(): CommandRegistration[] { callback: () => { notify("Help&Feedback report a bug selected.", MessageKind.DEBUG, { logger, - telemetry: "Help&Feedback.Open.ReportBug", + telemetry: "Help.Open.ReportBug", }); vscode.env.openExternal(vscode.Uri.parse(ext.urlLinks.reportBug)); }, @@ -688,7 +688,7 @@ function registerConnectionsCommands(): CommandRegistration[] { callback: () => { notify("Export all conections.", MessageKind.DEBUG, { logger, - telemetry: "Connections.Export.All", + telemetry: "Connection.Export.All", }); exportConnections(); }, @@ -698,7 +698,7 @@ function registerConnectionsCommands(): CommandRegistration[] { callback: async (viewItem: KdbNode | InsightsNode) => { notify("Export single conection.", MessageKind.DEBUG, { logger, - telemetry: "Connections.Export.Single", + telemetry: "Connection.Export.Single", }); exportConnections(viewItem.label); }, @@ -708,7 +708,7 @@ function registerConnectionsCommands(): CommandRegistration[] { callback: async () => { notify("Import conections.", MessageKind.DEBUG, { logger, - telemetry: "Connections.Import", + telemetry: "Connection.Import", }); await importConnections(); }, diff --git a/src/services/connectionManagerService.ts b/src/services/connectionManagerService.ts index 3c3b2d6a..390b883d 100644 --- a/src/services/connectionManagerService.ts +++ b/src/services/connectionManagerService.ts @@ -151,12 +151,7 @@ export class ConnectionManagementService { notify( `Connection established successfully to: ${connLabel}`, MessageKind.DEBUG, - { - logger, - telemetry: - "Connection.Connected" + - this.getTelemetryConnectionType(connLabel), - }, + { logger }, ); ext.connectedConnectionList.push(localConnection); @@ -177,9 +172,6 @@ export class ConnectionManagementService { { logger, params: { insightsVersion: insightsConn.insightsVersion }, - telemetry: - "Connection.Connected" + - this.getTelemetryConnectionType(connLabel), }, ); ext.connectedConnectionList.push(insightsConn); @@ -203,10 +195,7 @@ export class ConnectionManagementService { commands.executeCommand("setContext", "kdb.connected.active", [ `${node.label}`, ]); - notify("Connection activated.", MessageKind.DEBUG, { - logger, - telemetry: "Connection.Connected.Active", - }); + notify("Connection activated.", MessageKind.DEBUG, { logger }); commands.executeCommand("setContext", "kdb.pythonEnabled", true); ext.activeConnection = connection; ext.connectionNode = node; @@ -231,6 +220,7 @@ export class ConnectionManagementService { this.removeConnectionFromContextString(connNode.label); this.disconnect(connNode.label); } + let kind = ".kdb"; if (connNode instanceof InsightsNode) { const insights = getInsights(); const key = getKeyForServerName(connNode.details.alias); @@ -246,6 +236,8 @@ export class ConnectionManagementService { await updateInsights(updatedInsights); ext.serverProvider.refreshInsights(updatedInsights); + + kind = ".ie"; } } else { const servers: Server | undefined = getServers(); @@ -265,6 +257,10 @@ export class ConnectionManagementService { ext.serverProvider.refresh(updatedServers); } } + notify(`Connection ${connNode.label} removed`, MessageKind.DEBUG, { + logger, + telemetry: "Connection.Delete" + kind, + }); } public connectSuccessBehaviour(connNode: KdbNode | InsightsNode): void { @@ -285,8 +281,6 @@ export class ConnectionManagementService { notify(`Connection to ${connLabel} failed.`, MessageKind.ERROR, { logger, params: error, - telemetry: - "Connection.Failed" + this.getTelemetryConnectionType(connLabel), }); } @@ -315,7 +309,6 @@ export class ConnectionManagementService { } notify(`Connection closed: ${connection.connLabel}`, MessageKind.DEBUG, { logger, - telemetry: "Connection.Disconnected." + connType, }); ext.serverProvider.reload(); } @@ -570,17 +563,4 @@ export class ConnectionManagementService { ? "" : JSON.stringify(exportedContent, null, 2); } - - public getTelemetryConnectionType(connLabel: string): string { - const connection = this.retrieveConnection(connLabel); - - if (connection instanceof InsightsNode) { - return ".Insights"; - } - const isCustom = ext.customAuth ? ".CustomAuth" : ""; - if (connLabel === "local") { - return isCustom + ".KDB+.Local"; - } - return isCustom + ".KDB+"; - } } diff --git a/src/services/dataSourceEditorProvider.ts b/src/services/dataSourceEditorProvider.ts index 8fdfefb3..8779e83b 100644 --- a/src/services/dataSourceEditorProvider.ts +++ b/src/services/dataSourceEditorProvider.ts @@ -46,6 +46,7 @@ import { UDA } from "../models/uda"; import { getBasename, offerConnectAction } from "../utils/core"; import { getNonce } from "../utils/getNonce"; import { MessageKind, Runner, notify } from "../utils/notifications"; +import { notifyExecution } from "../utils/queryUtils"; import { parseUDAList } from "../utils/uda"; import { getUri } from "../utils/uriUtils"; @@ -221,6 +222,18 @@ export class DataSourceEditorProvider implements CustomTextEditorProvider { if (connected) await runner.execute(); else if (await offerConnectAction(selectedServer)) await runner.execute(); + notifyExecution( + true, + false, + false, + false, + true, + false, + false, + false, + false, + msg.dataSourceFile.dataSource.selectedType, + ); break; } case DataSourceCommand.Populate: { @@ -231,6 +244,18 @@ export class DataSourceEditorProvider implements CustomTextEditorProvider { if (connected) await runner.execute(); else if (await offerConnectAction(selectedServer)) await runner.execute(); + notifyExecution( + false, + false, + false, + false, + true, + false, + false, + false, + false, + msg.dataSourceFile.dataSource.selectedType, + ); break; } } diff --git a/src/services/notebookController.ts b/src/services/notebookController.ts index 6f614e75..c9b7d4c3 100644 --- a/src/services/notebookController.ts +++ b/src/services/notebookController.ts @@ -37,6 +37,7 @@ import { needsScratchpad, getPythonWrapper, getSQLWrapper, + notifyExecution, } from "../utils/queryUtils"; import { convertToGrid, formatResult } from "../utils/resultsRenderer"; @@ -170,6 +171,18 @@ export class KxNotebookController { }), ]); + notifyExecution( + !variable, + false, + true, + false, + isInsights, + !!target, + false, + kind === CellKind.PYTHON, + kind === CellKind.SQL, + ); + if (variable) { results = `Scratchpad variable (${variable}) populated.`; } diff --git a/src/utils/connLabel.ts b/src/utils/connLabel.ts index f320a05f..b05ae969 100644 --- a/src/utils/connLabel.ts +++ b/src/utils/connLabel.ts @@ -41,14 +41,6 @@ export function clearWorkspaceLabels() { getWorkspaceLabelsConnMap(); if (ext.connLabelList.length === 0) { - notify( - "Cleaning connection mappings for nonexistent labels.", - MessageKind.DEBUG, - { - logger, - telemetry: "Label.Cleanup.NoLabels", - }, - ); workspace.getConfiguration().update("kdb.labelsConnectionMap", [], true); return; } @@ -67,16 +59,6 @@ export function clearWorkspaceLabels() { workspace .getConfiguration() .update("kdb.labelsConnectionMap", ext.labelConnMapList, true); - - notify( - `Removed ${removedCount} orphaned label connection mapping${removedCount > 1 ? "s" : ""}.`, - MessageKind.DEBUG, - { - logger, - telemetry: "Label.Cleanup.OrphanedMappings", - measurements: { removedMappings: removedCount }, - }, - ); } } @@ -92,7 +74,6 @@ export function createNewLabel(name: string, colorName: string) { if (checkIfLabelExists(name)) { notify("Label with this name already exists.", MessageKind.ERROR, { logger, - telemetry: "Label.Create.Exists", }); return; } @@ -111,7 +92,7 @@ export function createNewLabel(name: string, colorName: string) { notify("Connection label created.", MessageKind.DEBUG, { logger, - telemetry: "Label.Create", + telemetry: "Connection.Label.Create", measurements: getLabelStatistics(), }); } else { @@ -167,7 +148,7 @@ export function addConnToLabel(labelName: string, connName: string) { } notify("Connection assigned to label.", MessageKind.DEBUG, { logger, - telemetry: "Label.Assign.Connection", + telemetry: "Connection.Label.Assign", measurements: getConnectionLabelStatistics(connName), }); } @@ -187,7 +168,7 @@ export function removeConnFromLabels(connName: string) { notify("Connection removed from label.", MessageKind.DEBUG, { logger, - telemetry: "Label.Remove.Connection", + telemetry: "Connection.Label.Unassign", measurements: getConnectionLabelStatistics(connName), }); } @@ -224,7 +205,6 @@ export function renameLabel(name: string, newName: string) { if (checkIfLabelExists(newName)) { notify("Label with this name already exists.", MessageKind.ERROR, { logger, - telemetry: "Label.Rename.Exists", }); return; } @@ -275,7 +255,7 @@ export function deleteLabel(name: string) { notify("Connection label deleted.", MessageKind.DEBUG, { logger, - telemetry: "Label.Delete", + telemetry: "Connection.Label.Delete", measurements: getLabelStatistics(), }); diff --git a/src/utils/core.ts b/src/utils/core.ts index 97a9d415..c285bbe3 100644 --- a/src/utils/core.ts +++ b/src/utils/core.ts @@ -75,7 +75,7 @@ export async function checkOpenSslInstalled(): Promise { // kdbOutputLog(`Error in checking OpenSSL version: ${err}`, "ERROR"); notify("OpenSSL not found.", MessageKind.DEBUG, { logger, - telemetry: err as Error, + params: err, }); } return null; diff --git a/src/utils/dataSource.ts b/src/utils/dataSource.ts index 47be364a..ac0d29c2 100644 --- a/src/utils/dataSource.ts +++ b/src/utils/dataSource.ts @@ -152,10 +152,7 @@ export async function addDSToLocalFolder(ds: DataSourceFiles): Promise { filePath = path.join(importToUri.fsPath, fileName); } fs.writeFileSync(filePath, JSON.stringify(ds)); - notify(`Datasource created.`, MessageKind.INFO, { - logger, - telemetry: "Datasource.Created", - }); + notify(`Datasource created.`, MessageKind.INFO, { logger }); } /* c8 ignore stop */ } diff --git a/src/utils/feedbackSurveyUtils.ts b/src/utils/feedbackSurveyUtils.ts index 9b18c152..3e2c2e9c 100644 --- a/src/utils/feedbackSurveyUtils.ts +++ b/src/utils/feedbackSurveyUtils.ts @@ -62,7 +62,7 @@ async function showSurveyDialog() { } else if (result === "Don't show me this message next time") { notify("Take survey message silenced.", MessageKind.DEBUG, { logger, - telemetry: "Help&Feedback.Hide.Survey", + telemetry: "Help.Hide.Survey", }); await vscode.workspace diff --git a/src/utils/queryUtils.ts b/src/utils/queryUtils.ts index 8d42494d..7578817b 100644 --- a/src/utils/queryUtils.ts +++ b/src/utils/queryUtils.ts @@ -528,3 +528,40 @@ export function needsScratchpad(connLabel: string, target: Promise) { export function resetScratchpadStarted(connLabel: string) { ext.scratchpadStarted.delete(connLabel); } + +export function notifyExecution( + isRun: boolean, + isWorkbook: boolean, + isNotebook: boolean, + isRepl: boolean, + isInsights: boolean, + isDap: boolean, + isQuick: boolean, + isPython: boolean, + isSql: boolean, + dsType?: DataSourceTypes, +) { + notify("Query execution.", MessageKind.DEBUG, { + logger, + telemetry: + (isRun ? "Run" : "Populate") + + (dsType + ? ".Datasource." + + (dsType === DataSourceTypes.API + ? ".api" + : dsType === DataSourceTypes.QSQL + ? ".q" + : dsType === DataSourceTypes.SQL + ? ".sql" + : ".uda") + : isWorkbook + ? ".Workbook" + : isNotebook + ? ".Cell" + : ".File") + + (isRepl ? ".repl" : isInsights ? ".ie" : ".kdb") + + (isDap ? ".dap" : "") + + (isQuick ? ".quick" : "") + + (isPython ? ".py" : isSql ? ".sql" : ".q"), + }); +} diff --git a/src/utils/workspace.ts b/src/utils/workspace.ts index a5436567..f2f1b86a 100644 --- a/src/utils/workspace.ts +++ b/src/utils/workspace.ts @@ -92,15 +92,7 @@ export async function addWorkspaceFile( scheme: "untitled", }); - const telemetryStats = await getWorkbookStatistics(ext, directory); - const isPython = ext === ".kdb.py" ? ".Python" : ".q"; - - notify("Workbook created.", MessageKind.DEBUG, { - logger, - telemetry: "Workbook.Create" + isPython, - measurements: telemetryStats, - }); - + notify("Workbook created.", MessageKind.DEBUG, { logger }); return uri; } } @@ -127,18 +119,6 @@ export async function openWith( await commands.executeCommand("vscode.openWith", uri, type, options); } -export async function getWorkbookStatistics( - ext: string, - directory = ".kx", -): Promise<{ count: number }> { - const folders = workspace.workspaceFolders; - if (folders) { - const files = await workspace.findFiles(`${directory}/*${ext}`); - return { count: files.length }; - } - throw new Error("No workspace has been opened"); -} - export async function pickWorkspace() { const folders = workspace.workspaceFolders; if (!folders || folders.length === 0) return undefined; diff --git a/test/suite/server/qLangServer.test.ts b/test/suite/server/qLangServer.test.ts index a5c5d2dd..d27d3b28 100644 --- a/test/suite/server/qLangServer.test.ts +++ b/test/suite/server/qLangServer.test.ts @@ -533,12 +533,13 @@ describe("qLangServer", () => { describe("notify", () => { it("", () => { const stub = sinon.stub(connection, "sendNotification"); - server["notify"]("test", "DEBUG", {}, true); + server["notify"]("test", "DEBUG", { telemetry: true }); sinon.assert.calledOnceWithExactly(stub, "notify", { message: "test", kind: "DEBUG", - options: {}, - telemetry: true, + options: { + telemetry: true, + }, }); }); }); diff --git a/test/suite/services/connectionManagementService.test.ts b/test/suite/services/connectionManagementService.test.ts index 4b3a3eed..c880853c 100644 --- a/test/suite/services/connectionManagementService.test.ts +++ b/test/suite/services/connectionManagementService.test.ts @@ -346,7 +346,6 @@ describe("ConnectionManagementService", () => { vscode.window, "showErrorMessage", ); - const sendEventStub = sinon.stub(Telemetry, "sendEvent"); const testLabel = "testLabel"; connectionManagerService.connectFailBehaviour(testLabel); @@ -354,7 +353,6 @@ describe("ConnectionManagementService", () => { showErrorMessageStub, `Connection to ${testLabel} failed.`, ); - sinon.assert.calledWith(sendEventStub, "Connection.Failed.KDB+"); }); it("disconnectBehaviour", () => { diff --git a/test/suite/services/notebook/notebookController.test.ts b/test/suite/services/notebook/notebookController.test.ts index 9174abf3..69857997 100644 --- a/test/suite/services/notebook/notebookController.test.ts +++ b/test/suite/services/notebook/notebookController.test.ts @@ -228,7 +228,7 @@ describe("Controller", () => { notebookTestUtils.createNotebook(), createController(), ); - sinon.assert.notCalled(notifyStub); + sinon.assert.calledOnce(notifyStub); assert.strictEqual(success, true); }); @@ -239,7 +239,7 @@ describe("Controller", () => { notebookTestUtils.createNotebook(), createController(), ); - sinon.assert.notCalled(notifyStub); + sinon.assert.calledOnce(notifyStub); assert.strictEqual(success, true); }); @@ -250,7 +250,7 @@ describe("Controller", () => { notebookTestUtils.createNotebook(), createController(), ); - sinon.assert.notCalled(notifyStub); + sinon.assert.calledOnce(notifyStub); assert.strictEqual(success, true); }); }); @@ -263,7 +263,7 @@ describe("Controller", () => { notebookTestUtils.createNotebook(), createController(), ); - sinon.assert.notCalled(notifyStub); + sinon.assert.calledOnce(notifyStub); assert.strictEqual(success, true); }); }); @@ -276,12 +276,7 @@ describe("Controller", () => { notebookTestUtils.createNotebook(), createController(), ); - sinon.assert.calledOnceWithExactly( - notifyStub, - sinon.match.string, - notifications.MessageKind.DEBUG, - sinon.match.any, - ); + sinon.assert.calledTwice(notifyStub); assert.strictEqual(success, false); }); }); diff --git a/test/suite/utils/connLabel.test.ts b/test/suite/utils/connLabel.test.ts index 95a4242d..e5aa2e2c 100644 --- a/test/suite/utils/connLabel.test.ts +++ b/test/suite/utils/connLabel.test.ts @@ -351,16 +351,6 @@ describe("connLabels", () => { LabelsUtils.clearWorkspaceLabels(); - sinon.assert.calledWith( - notifyStub, - "Cleaning connection mappings for nonexistent labels.", - notifications.MessageKind.DEBUG, - { - logger: "connLabel", - telemetry: "Label.Cleanup.NoLabels", - }, - ); - sinon.assert.calledWith(updateStub, "kdb.labelsConnectionMap", [], true); }); @@ -394,17 +384,6 @@ describe("connLabels", () => { { labelName: "label2", connections: ["conn4"] }, ]); - sinon.assert.calledWith( - notifyStub, - "Removed 2 orphaned label connection mappings.", - notifications.MessageKind.DEBUG, - { - logger: "connLabel", - telemetry: "Label.Cleanup.OrphanedMappings", - measurements: { removedMappings: 2 }, - }, - ); - sinon.assert.calledWith( updateStub, "kdb.labelsConnectionMap", @@ -438,17 +417,6 @@ describe("connLabels", () => { assert.deepStrictEqual(ext.labelConnMapList, [ { labelName: "label1", connections: ["conn1"] }, ]); - - sinon.assert.calledWith( - notifyStub, - "Removed 1 orphaned label connection mapping.", - notifications.MessageKind.DEBUG, - { - logger: "connLabel", - telemetry: "Label.Cleanup.OrphanedMappings", - measurements: { removedMappings: 1 }, - }, - ); }); it("should not remove anything when all mappings are valid", () => { @@ -542,17 +510,6 @@ describe("connLabels", () => { assert.strictEqual(ext.labelConnMapList.length, 1); assert.strictEqual(ext.labelConnMapList[0].labelName, "Label1"); - - sinon.assert.calledWith( - notifyStub, - "Removed 2 orphaned label connection mappings.", - notifications.MessageKind.DEBUG, - { - logger: "connLabel", - telemetry: "Label.Cleanup.OrphanedMappings", - measurements: { removedMappings: 2 }, - }, - ); }); }); From f87c9d42b7c9fd40fb73a3eb9b130469ddbf97bb Mon Sep 17 00:00:00 2001 From: ecmel Date: Thu, 18 Dec 2025 12:15:17 +0300 Subject: [PATCH 2/2] added test --- ref_card.md | 233 +++++++++++------------ server/src/qLangServer.ts | 27 ++- src/commands/workspaceCommand.ts | 30 ++- src/services/dataSourceEditorProvider.ts | 22 +-- src/services/notebookController.ts | 16 +- src/utils/queryUtils.ts | 68 +++---- test/suite/utils/queryUtils.test.ts | 113 +++++++++++ 7 files changed, 297 insertions(+), 212 deletions(-) diff --git a/ref_card.md b/ref_card.md index 3b8e5d48..6cc2af05 100644 --- a/ref_card.md +++ b/ref_card.md @@ -74,120 +74,119 @@ ## Telemetry -| Telemetry | Measurements | Source | -| :------------------------------- | :----------: | :--------------------------------------- | -| Extension.Activated | | src/extension.ts | -| Extension.CustomAuth.Activated | | src/extension.ts | -| ¦ | | | -| Welcome.Displayed | | src/commands/setupCommand.ts | -| Install.kdbx | | src/commands/setupCommand.ts | -| Install.kdbx.workspace | | src/commands/setupCommand.ts | -| Install.kdbx.win32.fail | | src/commands/setupCommand.ts | -| Repl.Start | | src/commands/workspaceCommand.ts | -| ¦ | | | -| Connection.Create.kdb | | src/commands/serverCommand.ts | -| Connection.Edit.kdb | | src/commands/serverCommand.ts | -| Connection.Delete.kdb | | src/services/connectionManagerService.ts | -| Connection.Create.ie | | src/commands/serverCommand.ts | -| Connection.Edit.ie | | src/commands/serverCommand.ts | -| Connection.Delete.ie | | src/services/connectionManagerService.ts | -| Connection.Export.All | | src/extension.ts | -| Connection.Export.Single | | src/extension.ts | -| Connection.Import | | src/extension.ts | -| Connection.Reset.ie.sp | | src/classes/insightsConnection.ts | -| Connection.Label.Create | ✓ | src/utils/connLabel.ts | -| Connection.Label.Assign | ✓ | src/utils/connLabel.ts | -| Connection.Label.Unassign | ✓ | src/utils/connLabel.ts | -| Connection.Label.Delete | ✓ | src/utils/connLabel.ts | -| ¦ | | | -| Run.Workbook.repl.q | | src/utils/queryUtils.ts | -| Run.Workbook.repl.py | | src/utils/queryUtils.ts | -| Run.Workbook.repl.sql | | src/utils/queryUtils.ts | -| Run.File.repl.q | | src/utils/queryUtils.ts | -| Run.File.repl.py | | src/utils/queryUtils.ts | -| Run.File.repl.sql | | src/utils/queryUtils.ts | -| Run.Cell.repl.q | | src/utils/queryUtils.ts | -| Run.Cell.repl.py | | src/utils/queryUtils.ts | -| Run.Cell.repl.sql | | src/utils/queryUtils.ts | -| ¦ | | | -| Run.Workbook.kdb.q | | src/utils/queryUtils.ts | -| Run.Workbook.kdb.py | | src/utils/queryUtils.ts | -| Run.Workbook.kdb.sql | | src/utils/queryUtils.ts | -| Run.File.kdb.q | | src/utils/queryUtils.ts | -| Run.File.kdb.py | | src/utils/queryUtils.ts | -| Run.File.kdb.sql | | src/utils/queryUtils.ts | -| Run.Cell.kdb.q | | src/utils/queryUtils.ts | -| Run.Cell.kdb.py | | src/utils/queryUtils.ts | -| Run.Cell.kdb.sql | | src/utils/queryUtils.ts | -| ¦ | | | -| Run.Workbook.ie.q | | src/utils/queryUtils.ts | -| Run.Workbook.ie.py | | src/utils/queryUtils.ts | -| Run.Workbook.ie.sql | | src/utils/queryUtils.ts | -| Run.File.ie.q | | src/utils/queryUtils.ts | -| Run.File.ie.py | | src/utils/queryUtils.ts | -| Run.File.ie.sql | | src/utils/queryUtils.ts | -| Run.Cell.ie.q | | src/utils/queryUtils.ts | -| Run.Cell.ie.py | | src/utils/queryUtils.ts | -| Run.Cell.ie.sql | | src/utils/queryUtils.ts | -| ¦ | | | -| Run.Workbook.ie.dap.q | | src/utils/queryUtils.ts | -| Run.Workbook.ie.dap.py | | src/utils/queryUtils.ts | -| Run.File.ie.dap.q | | src/utils/queryUtils.ts | -| Run.File.ie.dap.py | | src/utils/queryUtils.ts | -| Run.Cell.ie.dap.q | | src/utils/queryUtils.ts | -| Run.Cell.ie.dap.py | | src/utils/queryUtils.ts | -| ¦ | | | -| Run.Workbook.kdb.quick.q | | | -| Run.Workbook.kdb.quick.py | | | -| Run.Workbook.kdb.quick.sql | | | -| Run.File.kdb.quick.q | | | -| Run.File.kdb.quick.py | | | -| Run.File.kdb.quick.sql | | | -| Run.Cell.kdb.quick.q | | | -| Run.Cell.kdb.quick.py | | | -| Run.Cell.kdb.quick.sql | | | -| ¦ | | | -| Run.Datasource.api | | src/utils/queryUtils.ts | -| Run.Datasource.q | | src/utils/queryUtils.ts | -| Run.Datasource.sql | | src/utils/queryUtils.ts | -| Run.Datasource.uda | | src/utils/queryUtils.ts | -| ¦ | | | -| Populate.Datasource.api | | src/utils/queryUtils.ts | -| Populate.Datasource.q | | src/utils/queryUtils.ts | -| Populate.Datasource.sql | | src/utils/queryUtils.ts | -| Populate.Datasource.uda | | src/utils/queryUtils.ts | -| ¦ | | | -| Populate.Workbook.q | | src/utils/queryUtils.ts | -| Populate.Workbook.py | | src/utils/queryUtils.ts | -| Populate.Workbook.sql | | src/utils/queryUtils.ts | -| Populate.File.q | | src/utils/queryUtils.ts | -| Populate.File.py | | src/utils/queryUtils.ts | -| Populate.File.sql | | src/utils/queryUtils.ts | -| Populate.Cell.q | | src/utils/queryUtils.ts | -| Populate.Cell.py | | src/utils/queryUtils.ts | -| Populate.Cell.sql | | src/utils/queryUtils.ts | -| ¦ | | | -| Graphics.Displayed.kdb.q | | src/commands/serverCommand.ts | -| Graphics.Displayed.kdb.py | | src/commands/serverCommand.ts | -| Graphics.Displayed.ie.q | | src/commands/serverCommand.ts | -| Graphics.Displayed.ie.py | | src/commands/serverCommand.ts | -| ¦ | | | -| Debugger.Run | | | -| Debugger.Resume | | | -| Debugger.StepOver | | | -| Debugger.SetBreakPoint | | | -| ¦ | | | -| Language.onReferences | | server/src/qLangServer.ts | -| Language.onDefinition | | server/src/qLangServer.ts | -| Language.onCompletion | | server/src/qLangServer.ts | -| Language.onRenameRequest | | server/src/qLangServer.ts | -| Language.onParameterCache | | server/src/qLangServer.ts | -| Language.onFoldingRanges | | server/src/qLangServer.ts | -| Language.onIncomingCallHierarchy | | server/src/qLangServer.ts | -| Language.onOutgoingCallHierarchy | | server/src/qLangServer.ts | -| ¦ | | | -| Help.Open.Documentation | | src/extension.ts | -| Help.Open.ReportBug | | src/extension.ts | -| Help.Open.SuggestFeature | | src/extension.ts | -| Help.Open.Survey | | src/extension.ts | -| Help.Hide.Survey | | src/utils/feedbackSurveyUtils.ts | +| Telemetry | Measurements | Source | +| :----------------------------- | :----------: | :--------------------------------------- | +| Extension.Activated | | src/extension.ts | +| Extension.CustomAuth.Activated | | src/extension.ts | +| ¦ | | | +| Welcome.Displayed | | src/commands/setupCommand.ts | +| Install.kdbx | | src/commands/setupCommand.ts | +| Install.kdbx.workspace | | src/commands/setupCommand.ts | +| Install.kdbx.win32.fail | | src/commands/setupCommand.ts | +| Repl.Start | | src/commands/workspaceCommand.ts | +| ¦ | | | +| Connection.Create.kdb | | src/commands/serverCommand.ts | +| Connection.Edit.kdb | | src/commands/serverCommand.ts | +| Connection.Delete.kdb | | src/services/connectionManagerService.ts | +| Connection.Create.ie | | src/commands/serverCommand.ts | +| Connection.Edit.ie | | src/commands/serverCommand.ts | +| Connection.Delete.ie | | src/services/connectionManagerService.ts | +| Connection.Export.All | | src/extension.ts | +| Connection.Export.Single | | src/extension.ts | +| Connection.Import | | src/extension.ts | +| Connection.Reset.ie.sp | | src/classes/insightsConnection.ts | +| Connection.Label.Create | ✓ | src/utils/connLabel.ts | +| Connection.Label.Assign | ✓ | src/utils/connLabel.ts | +| Connection.Label.Unassign | ✓ | src/utils/connLabel.ts | +| Connection.Label.Delete | ✓ | src/utils/connLabel.ts | +| ¦ | | | +| Run.Workbook.repl.q | | src/utils/queryUtils.ts | +| Run.Workbook.repl.py | | src/utils/queryUtils.ts | +| Run.Workbook.repl.sql | | src/utils/queryUtils.ts | +| Run.File.repl.q | | src/utils/queryUtils.ts | +| Run.File.repl.py | | src/utils/queryUtils.ts | +| Run.File.repl.sql | | src/utils/queryUtils.ts | +| Run.Cell.repl.q | | src/utils/queryUtils.ts | +| Run.Cell.repl.py | | src/utils/queryUtils.ts | +| Run.Cell.repl.sql | | src/utils/queryUtils.ts | +| ¦ | | | +| Run.Workbook.kdb.q | | src/utils/queryUtils.ts | +| Run.Workbook.kdb.py | | src/utils/queryUtils.ts | +| Run.Workbook.kdb.sql | | src/utils/queryUtils.ts | +| Run.File.kdb.q | | src/utils/queryUtils.ts | +| Run.File.kdb.py | | src/utils/queryUtils.ts | +| Run.File.kdb.sql | | src/utils/queryUtils.ts | +| Run.Cell.kdb.q | | src/utils/queryUtils.ts | +| Run.Cell.kdb.py | | src/utils/queryUtils.ts | +| Run.Cell.kdb.sql | | src/utils/queryUtils.ts | +| ¦ | | | +| Run.Workbook.ie.q | | src/utils/queryUtils.ts | +| Run.Workbook.ie.py | | src/utils/queryUtils.ts | +| Run.Workbook.ie.sql | | src/utils/queryUtils.ts | +| Run.File.ie.q | | src/utils/queryUtils.ts | +| Run.File.ie.py | | src/utils/queryUtils.ts | +| Run.File.ie.sql | | src/utils/queryUtils.ts | +| Run.Cell.ie.q | | src/utils/queryUtils.ts | +| Run.Cell.ie.py | | src/utils/queryUtils.ts | +| Run.Cell.ie.sql | | src/utils/queryUtils.ts | +| ¦ | | | +| Run.Workbook.ie.dap.q | | src/utils/queryUtils.ts | +| Run.Workbook.ie.dap.py | | src/utils/queryUtils.ts | +| Run.File.ie.dap.q | | src/utils/queryUtils.ts | +| Run.File.ie.dap.py | | src/utils/queryUtils.ts | +| Run.Cell.ie.dap.q | | src/utils/queryUtils.ts | +| Run.Cell.ie.dap.py | | src/utils/queryUtils.ts | +| ¦ | | | +| Run.Workbook.kdb.quick.q | | | +| Run.Workbook.kdb.quick.py | | | +| Run.Workbook.kdb.quick.sql | | | +| Run.File.kdb.quick.q | | | +| Run.File.kdb.quick.py | | | +| Run.File.kdb.quick.sql | | | +| Run.Cell.kdb.quick.q | | | +| Run.Cell.kdb.quick.py | | | +| Run.Cell.kdb.quick.sql | | | +| ¦ | | | +| Run.Datasource.api | | src/utils/queryUtils.ts | +| Run.Datasource.qsql | | src/utils/queryUtils.ts | +| Run.Datasource.sql | | src/utils/queryUtils.ts | +| Run.Datasource.uda | | src/utils/queryUtils.ts | +| ¦ | | | +| Populate.Datasource.api | | src/utils/queryUtils.ts | +| Populate.Datasource.qsql | | src/utils/queryUtils.ts | +| Populate.Datasource.sql | | src/utils/queryUtils.ts | +| Populate.Datasource.uda | | src/utils/queryUtils.ts | +| ¦ | | | +| Populate.Workbook.q | | src/utils/queryUtils.ts | +| Populate.Workbook.py | | src/utils/queryUtils.ts | +| Populate.Workbook.sql | | src/utils/queryUtils.ts | +| Populate.File.q | | src/utils/queryUtils.ts | +| Populate.File.py | | src/utils/queryUtils.ts | +| Populate.File.sql | | src/utils/queryUtils.ts | +| Populate.Cell.q | | src/utils/queryUtils.ts | +| Populate.Cell.py | | src/utils/queryUtils.ts | +| Populate.Cell.sql | | src/utils/queryUtils.ts | +| ¦ | | | +| Graphics.Displayed.kdb.q | | src/commands/serverCommand.ts | +| Graphics.Displayed.kdb.py | | src/commands/serverCommand.ts | +| Graphics.Displayed.ie.q | | src/commands/serverCommand.ts | +| Graphics.Displayed.ie.py | | src/commands/serverCommand.ts | +| ¦ | | | +| Language.References | | server/src/qLangServer.ts | +| Language.Definition | | server/src/qLangServer.ts | +| Language.Completion | | server/src/qLangServer.ts | +| Language.RenameRequest | | server/src/qLangServer.ts | +| Language.ParameterCache | | server/src/qLangServer.ts | +| Language.FoldingRanges | | server/src/qLangServer.ts | +| Language.CallHierarchy | | server/src/qLangServer.ts | +| ¦ | | | +| Debugger.Run | | | +| Debugger.Resume | | | +| Debugger.StepOver | | | +| Debugger.SetBreakPoint | | | +| ¦ | | | +| Help.Open.Documentation | | src/extension.ts | +| Help.Open.ReportBug | | src/extension.ts | +| Help.Open.SuggestFeature | | src/extension.ts | +| Help.Open.Survey | | src/extension.ts | +| Help.Hide.Survey | | src/utils/feedbackSurveyUtils.ts | diff --git a/server/src/qLangServer.ts b/server/src/qLangServer.ts index 1fc9fce8..3585e272 100644 --- a/server/src/qLangServer.ts +++ b/server/src/qLangServer.ts @@ -253,7 +253,7 @@ export default class QLangServer { }: ReferenceParams): Promise { this.notify("onReferences", MessageKind.DEBUG, { logger, - telemetry: "Language.onReferences", + telemetry: "Language.References", }); const source = await this.getSource(uri); @@ -277,7 +277,7 @@ export default class QLangServer { }: DefinitionParams): Promise { this.notify("onDefinition", MessageKind.DEBUG, { logger, - telemetry: "Language.onDefinition", + telemetry: "Language.Definition", }); const source = await this.getSource(uri); @@ -302,7 +302,7 @@ export default class QLangServer { }: RenameParams): Promise { this.notify("onRenameRequest", MessageKind.DEBUG, { logger, - telemetry: "Language.onRenameRequest", + telemetry: "Language.RenameRequest", }); const source = await this.getSource(uri); @@ -341,7 +341,7 @@ export default class QLangServer { }: CompletionParams): Promise { this.notify("onCompletion", MessageKind.DEBUG, { logger, - telemetry: "Language.onCompletion", + telemetry: "Language.Completion", }); const source = await this.getSource(uri); @@ -394,7 +394,7 @@ export default class QLangServer { }: TextDocumentPositionParams) { this.notify("onParameterCache", MessageKind.DEBUG, { logger, - telemetry: "Language.onParameterCache", + telemetry: "Language.ParameterCache", }); const source = await this.getSource(uri); @@ -453,7 +453,7 @@ export default class QLangServer { }: FoldingRangeParams): Promise { this.notify("onFoldingRanges", MessageKind.DEBUG, { logger, - telemetry: "Language.onFoldingRanges", + telemetry: "Language.FoldingRanges", }); const source = await this.getSource(uri); @@ -515,6 +515,11 @@ export default class QLangServer { textDocument: { uri }, position, }: CallHierarchyPrepareParams): Promise { + this.notify("onCallHierarchy", MessageKind.DEBUG, { + logger, + telemetry: "Language.CallHierarchy", + }); + const source = await this.getSource(uri); const target = source.tokenAt(position); @@ -533,11 +538,6 @@ export default class QLangServer { public async onIncomingCallsCallHierarchy({ item: { data, uri, name }, }: CallHierarchyIncomingCallsParams): Promise { - this.notify("onIncomingCallHierarchy", MessageKind.DEBUG, { - logger, - telemetry: "Language.onIncomingCallHierarchy", - }); - const incoming: CallHierarchyIncomingCall[] = []; if (!data) return incoming; @@ -567,11 +567,6 @@ export default class QLangServer { public async onOutgoingCallsCallHierarchy({ item: { data, uri, name }, }: CallHierarchyOutgoingCallsParams): Promise { - this.notify("onOutgoingCallHierarchy", MessageKind.DEBUG, { - logger, - telemetry: "Language.onOutgoingCallHierarchy", - }); - const outgoing: CallHierarchyOutgoingCall[] = []; if (!data) return outgoing; diff --git a/src/commands/workspaceCommand.ts b/src/commands/workspaceCommand.ts index 7958ff15..433b2b80 100644 --- a/src/commands/workspaceCommand.ts +++ b/src/commands/workspaceCommand.ts @@ -47,6 +47,7 @@ import { Runner, } from "../utils/notifications"; import { + ExecFlags, getPythonWrapper, getSQLWrapper, notifyExecution, @@ -542,15 +543,11 @@ export async function runActiveEditor(type?: ExecutionTypes) { if (server === undefined) { await runOnRepl(ext.activeTextEditor, type); notifyExecution( - true, - !!isWorkbook(uri), - false, - true, - false, - false, - false, - !!isPython(uri), - !!isSql(uri), + ExecFlags.Run | + ExecFlags.Repl | + (isWorkbook(uri) ? ExecFlags.Workbook : 0) | + (isPython(uri) ? ExecFlags.Python : 0) | + (isSql(uri) ? ExecFlags.Sql : 0), ); return; } @@ -588,15 +585,12 @@ export async function runActiveEditor(type?: ExecutionTypes) { isInsights, ); notifyExecution( - type !== ExecutionTypes.PopulateScratchpad, - !!isWorkbook(uri), - false, - false, - isInsights, - !!target, - false, - !!isPython(uri), - !!isSql(uri), + (type === ExecutionTypes.PopulateScratchpad ? 0 : ExecFlags.Run) | + (isInsights ? ExecFlags.Insights : 0) | + (target ? ExecFlags.Dap : 0) | + (isWorkbook(uri) ? ExecFlags.Workbook : 0) | + (isPython(uri) ? ExecFlags.Python : 0) | + (isSql(uri) ? ExecFlags.Sql : 0), ); } catch (error) { notify( diff --git a/src/services/dataSourceEditorProvider.ts b/src/services/dataSourceEditorProvider.ts index 8779e83b..c51f1377 100644 --- a/src/services/dataSourceEditorProvider.ts +++ b/src/services/dataSourceEditorProvider.ts @@ -46,7 +46,7 @@ import { UDA } from "../models/uda"; import { getBasename, offerConnectAction } from "../utils/core"; import { getNonce } from "../utils/getNonce"; import { MessageKind, Runner, notify } from "../utils/notifications"; -import { notifyExecution } from "../utils/queryUtils"; +import { ExecFlags, notifyExecution } from "../utils/queryUtils"; import { parseUDAList } from "../utils/uda"; import { getUri } from "../utils/uriUtils"; @@ -223,15 +223,7 @@ export class DataSourceEditorProvider implements CustomTextEditorProvider { else if (await offerConnectAction(selectedServer)) await runner.execute(); notifyExecution( - true, - false, - false, - false, - true, - false, - false, - false, - false, + ExecFlags.Run | ExecFlags.Insights, msg.dataSourceFile.dataSource.selectedType, ); break; @@ -245,15 +237,7 @@ export class DataSourceEditorProvider implements CustomTextEditorProvider { else if (await offerConnectAction(selectedServer)) await runner.execute(); notifyExecution( - false, - false, - false, - false, - true, - false, - false, - false, - false, + ExecFlags.Insights, msg.dataSourceFile.dataSource.selectedType, ); break; diff --git a/src/services/notebookController.ts b/src/services/notebookController.ts index c9b7d4c3..ff867962 100644 --- a/src/services/notebookController.ts +++ b/src/services/notebookController.ts @@ -38,6 +38,7 @@ import { getPythonWrapper, getSQLWrapper, notifyExecution, + ExecFlags, } from "../utils/queryUtils"; import { convertToGrid, formatResult } from "../utils/resultsRenderer"; @@ -172,15 +173,12 @@ export class KxNotebookController { ]); notifyExecution( - !variable, - false, - true, - false, - isInsights, - !!target, - false, - kind === CellKind.PYTHON, - kind === CellKind.SQL, + ExecFlags.Notebook | + (variable ? 0 : ExecFlags.Run) | + (isInsights ? ExecFlags.Insights : 0) | + (target ? ExecFlags.Dap : 0) | + (kind === CellKind.PYTHON ? ExecFlags.Python : 0) | + (kind === CellKind.SQL ? ExecFlags.Sql : 0), ); if (variable) { diff --git a/src/utils/queryUtils.ts b/src/utils/queryUtils.ts index 7578817b..673197b9 100644 --- a/src/utils/queryUtils.ts +++ b/src/utils/queryUtils.ts @@ -529,39 +529,41 @@ export function resetScratchpadStarted(connLabel: string) { ext.scratchpadStarted.delete(connLabel); } -export function notifyExecution( - isRun: boolean, - isWorkbook: boolean, - isNotebook: boolean, - isRepl: boolean, - isInsights: boolean, - isDap: boolean, - isQuick: boolean, - isPython: boolean, - isSql: boolean, - dsType?: DataSourceTypes, -) { - notify("Query execution.", MessageKind.DEBUG, { +export const enum ExecFlags { + Run = 0b000000001, + Workbook = 0b000000010, + Notebook = 0b000000100, + Repl = 0b000001000, + Insights = 0b000010000, + Quick = 0b000100000, + Dap = 0b001000000, + Python = 0b010000000, + Sql = 0b100000000, +} + +export function notifyExecution(flags: number, dsType?: string) { + const telemetry = + (flags & ExecFlags.Run ? "Run" : "Populate") + + (dsType + ? ".Datasource." + dsType.toLowerCase() + : flags & ExecFlags.Workbook + ? ".Workbook" + : flags & ExecFlags.Notebook + ? ".Cell" + : ".File") + + (flags & ExecFlags.Repl + ? ".repl" + : flags & ExecFlags.Insights + ? ".ie" + : ".kdb") + + (flags & ExecFlags.Quick ? ".quick" : "") + + (flags & ExecFlags.Dap ? ".dap" : "") + + (flags & ExecFlags.Python ? ".py" : flags & ExecFlags.Sql ? ".sql" : ".q"); + + notify(`Query ${telemetry} executed.`, MessageKind.DEBUG, { logger, - telemetry: - (isRun ? "Run" : "Populate") + - (dsType - ? ".Datasource." + - (dsType === DataSourceTypes.API - ? ".api" - : dsType === DataSourceTypes.QSQL - ? ".q" - : dsType === DataSourceTypes.SQL - ? ".sql" - : ".uda") - : isWorkbook - ? ".Workbook" - : isNotebook - ? ".Cell" - : ".File") + - (isRepl ? ".repl" : isInsights ? ".ie" : ".kdb") + - (isDap ? ".dap" : "") + - (isQuick ? ".quick" : "") + - (isPython ? ".py" : isSql ? ".sql" : ".q"), + telemetry, }); + + return telemetry; } diff --git a/test/suite/utils/queryUtils.test.ts b/test/suite/utils/queryUtils.test.ts index 2d1c8ca3..c35ad0b3 100644 --- a/test/suite/utils/queryUtils.test.ts +++ b/test/suite/utils/queryUtils.test.ts @@ -630,4 +630,117 @@ describe("queryUtils", () => { assert.strictEqual(ext.scratchpadStarted.has("test"), false); }); }); + + describe("notifyExecution", () => { + describe("repl", () => { + describe("File", () => { + it("should return telemetry for q", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | queryUtils.ExecFlags.Repl, + ); + assert.strictEqual(res, "Run.File.repl.q"); + }); + it("should return telemetry for Python", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Repl | + queryUtils.ExecFlags.Python, + ); + assert.strictEqual(res, "Run.File.repl.py"); + }); + it("should return telemetry for SQL", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Repl | + queryUtils.ExecFlags.Sql, + ); + assert.strictEqual(res, "Run.File.repl.sql"); + }); + }); + describe("Workbook", () => { + it("should return telemetry for q", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Workbook | + queryUtils.ExecFlags.Repl, + ); + assert.strictEqual(res, "Run.Workbook.repl.q"); + }); + it("should return telemetry for Python", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Workbook | + queryUtils.ExecFlags.Repl | + queryUtils.ExecFlags.Python, + ); + assert.strictEqual(res, "Run.Workbook.repl.py"); + }); + it("should return telemetry for SQL", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Workbook | + queryUtils.ExecFlags.Repl | + queryUtils.ExecFlags.Sql, + ); + assert.strictEqual(res, "Run.Workbook.repl.sql"); + }); + }); + }); + describe("kdb", () => { + describe("Workbook", () => { + it("should return telemetry for q", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | queryUtils.ExecFlags.Workbook, + ); + assert.strictEqual(res, "Run.Workbook.kdb.q"); + }); + it("should return telemetry for Python", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Workbook | + queryUtils.ExecFlags.Python, + ); + assert.strictEqual(res, "Run.Workbook.kdb.py"); + }); + it("should return telemetry for SQL", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Workbook | + queryUtils.ExecFlags.Sql, + ); + assert.strictEqual(res, "Run.Workbook.kdb.sql"); + }); + }); + }); + describe("ie", () => { + describe("Workbook", () => { + it("should return telemetry for q", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Workbook | + queryUtils.ExecFlags.Insights, + ); + assert.strictEqual(res, "Run.Workbook.ie.q"); + }); + it("should return telemetry for Python", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Workbook | + queryUtils.ExecFlags.Insights | + queryUtils.ExecFlags.Python, + ); + assert.strictEqual(res, "Run.Workbook.ie.py"); + }); + it("should return telemetry for SQL", () => { + const res = queryUtils.notifyExecution( + queryUtils.ExecFlags.Run | + queryUtils.ExecFlags.Workbook | + queryUtils.ExecFlags.Insights | + queryUtils.ExecFlags.Sql, + ); + assert.strictEqual(res, "Run.Workbook.ie.sql"); + }); + }); + }); + }); });