Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions redisinsight/api/src/constants/telemetry-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export enum TelemetryEvents {
WorkbenchIndexInfoSubmitted = 'WORKBENCH_INDEX_INFO_SUBMITTED',
WorkbenchCommandErrorReceived = 'WORKBENCH_COMMAND_ERROR_RECEIVED',
WorkbenchCommandDeleted = 'WORKBENCH_COMMAND_DELETE_COMMAND',

// Events for search tool
SearchCommandExecuted = 'SEARCH_COMMAND_EXECUTED',
SearchIndexInfoSubmitted = 'SEARCH_INDEX_INFO_SUBMITTED',
SearchCommandErrorReceived = 'SEARCH_COMMAND_ERROR_RECEIVED',

// Custom tutorials
WorkbenchEnablementAreaImportSucceeded = 'WORKBENCH_ENABLEMENT_AREA_IMPORT_SUCCEEDED',
WorkbenchEnablementAreaImportFailed = 'WORKBENCH_ENABLEMENT_AREA_IMPORT_FAILED',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ import {
FormatterTypes,
} from 'src/common/transformers';
import { DatabaseClientFactory } from 'src/modules/database/providers/database.client.factory';
import { RunQueryMode } from 'src/modules/workbench/models/command-execution';
import {
CommandExecutionType,
RunQueryMode,
} from 'src/modules/workbench/models/command-execution';
import { WorkbenchAnalytics } from 'src/modules/workbench/workbench.analytics';

const MOCK_ERROR_MESSAGE = 'Some error';
Expand Down Expand Up @@ -85,6 +88,7 @@ describe('WorkbenchCommandsExecutor', () => {
const result = await service.sendCommand(client, {
command: 'ft.info idx',
mode: RunQueryMode.Raw,
type: CommandExecutionType.Workbench,
});

expect(result).toEqual([
Expand All @@ -99,6 +103,7 @@ describe('WorkbenchCommandsExecutor', () => {
).toHaveBeenCalledWith(
mockSessionMetadata,
mockWorkbenchClientMetadata.databaseId,
CommandExecutionType.Workbench,
[
{
response: mockRedisFtInfoReply,
Expand All @@ -113,6 +118,7 @@ describe('WorkbenchCommandsExecutor', () => {
expect(mockAnalyticsService.sendIndexInfoEvent).toHaveBeenCalledWith(
mockSessionMetadata,
mockWorkbenchClientMetadata.databaseId,
CommandExecutionType.Workbench,
mockFtInfoAnalyticsData,
);
});
Expand All @@ -122,6 +128,7 @@ describe('WorkbenchCommandsExecutor', () => {
const result = await service.sendCommand(client, {
command: mockCreateCommandExecutionDto.command,
mode: RunQueryMode.ASCII,
type: CommandExecutionType.Workbench,
});

expect(result).toEqual([
Expand All @@ -136,6 +143,7 @@ describe('WorkbenchCommandsExecutor', () => {
).toHaveBeenCalledWith(
mockSessionMetadata,
mockWorkbenchClientMetadata.databaseId,
CommandExecutionType.Workbench,
[
{
response: mockCommandExecutionResult.response,
Expand All @@ -156,6 +164,7 @@ describe('WorkbenchCommandsExecutor', () => {
const result = await service.sendCommand(client, {
command: mockCreateCommandExecutionDto.command,
mode: RunQueryMode.ASCII,
type: CommandExecutionType.Workbench,
});

expect(result).toEqual([
Expand All @@ -170,6 +179,7 @@ describe('WorkbenchCommandsExecutor', () => {
).toHaveBeenCalledWith(
mockSessionMetadata,
mockWorkbenchClientMetadata.databaseId,
CommandExecutionType.Workbench,
{
response: MOCK_ERROR_MESSAGE,
error: new CommandNotSupportedError(MOCK_ERROR_MESSAGE),
Expand All @@ -192,6 +202,7 @@ describe('WorkbenchCommandsExecutor', () => {
const result = await service.sendCommand(client, {
command: mockCreateCommandExecutionDto.command,
mode: RunQueryMode.ASCII,
type: CommandExecutionType.Workbench,
});

expect(result).toEqual([
Expand All @@ -206,6 +217,7 @@ describe('WorkbenchCommandsExecutor', () => {
).toHaveBeenCalledWith(
mockSessionMetadata,
mockWorkbenchClientMetadata.databaseId,
CommandExecutionType.Workbench,
{
response: MOCK_ERROR_MESSAGE,
error: replyError,
Expand All @@ -227,6 +239,7 @@ describe('WorkbenchCommandsExecutor', () => {
const result = await service.sendCommand(client, {
command: mockCreateCommandExecutionDto.command,
mode: RunQueryMode.ASCII,
type: CommandExecutionType.Workbench,
});

expect(result).toEqual([
Expand All @@ -242,6 +255,7 @@ describe('WorkbenchCommandsExecutor', () => {
).toHaveBeenCalledWith(
mockSessionMetadata,
mockWorkbenchClientMetadata.databaseId,
CommandExecutionType.Workbench,
[
{
response: mockCommandExecutionResult.response,
Expand All @@ -264,6 +278,7 @@ describe('WorkbenchCommandsExecutor', () => {
const result = await service.sendCommand(client, {
command: mockCreateCommandExecutionDto.command,
mode: RunQueryMode.Raw,
type: CommandExecutionType.Workbench,
});

expect(result).toEqual([
Expand All @@ -279,6 +294,7 @@ describe('WorkbenchCommandsExecutor', () => {
).toHaveBeenCalledWith(
mockSessionMetadata,
mockWorkbenchClientMetadata.databaseId,
CommandExecutionType.Workbench,
[
{
response: mockCommandExecutionResult.response,
Expand All @@ -299,6 +315,7 @@ describe('WorkbenchCommandsExecutor', () => {
const result = await service.sendCommand(client, {
command: mockCreateCommandExecutionDto.command,
mode: RunQueryMode.ASCII,
type: CommandExecutionType.Workbench,
});

expect(result).toEqual([
Expand All @@ -313,6 +330,7 @@ describe('WorkbenchCommandsExecutor', () => {
).toHaveBeenCalledWith(
mockSessionMetadata,
mockWorkbenchClientMetadata.databaseId,
CommandExecutionType.Workbench,
{
response: MOCK_ERROR_MESSAGE,
error: new ServiceUnavailableException(MOCK_ERROR_MESSAGE),
Expand All @@ -337,6 +355,7 @@ describe('WorkbenchCommandsExecutor', () => {
const result = await service.sendCommand(client, {
command: mockGetEscapedKeyCommand,
mode: RunQueryMode.ASCII,
type: CommandExecutionType.Workbench,
});

expect(result).toEqual(mockResult);
Expand All @@ -345,6 +364,7 @@ describe('WorkbenchCommandsExecutor', () => {
).toHaveBeenCalledWith(
mockSessionMetadata,
mockWorkbenchClientMetadata.databaseId,
CommandExecutionType.Workbench,
{
response: ERROR_MESSAGES.CLI_UNTERMINATED_QUOTES(),
error: new CommandParsingError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class WorkbenchCommandsExecutor {
this.analyticsService.sendCommandExecutedEvents(
client.clientMetadata.sessionMetadata,
client.clientMetadata.databaseId,
dto.type,
result,
{ command, rawMode: mode === RunQueryMode.Raw },
);
Expand All @@ -87,6 +88,7 @@ export class WorkbenchCommandsExecutor {
this.analyticsService.sendIndexInfoEvent(
client.clientMetadata.sessionMetadata,
client.clientMetadata.databaseId,
dto.type,
getAnalyticsDataFromIndexInfo(response as string[]),
);
}
Expand All @@ -102,6 +104,7 @@ export class WorkbenchCommandsExecutor {
this.analyticsService.sendCommandExecutedEvent(
client.clientMetadata.sessionMetadata,
client.clientMetadata.databaseId,
dto.type,
{ ...errorResult, error },
{ command, rawMode: dto.mode === RunQueryMode.Raw },
);
Expand Down
Loading
Loading