Skip to content

Commit 32af41b

Browse files
Merge pull request #76 from RedisInsight/main
A new release candidate
2 parents 93fb64b + d57305b commit 32af41b

File tree

63 files changed

+385
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+385
-191
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@
4848
},
4949
"repository": {
5050
"type": "git",
51-
"url": "git+https://github.com/RedisLabs/redisinsight-v2.git"
51+
"url": "git+https://github.com/RedisInsight/RedisInsight.git"
5252
},
5353
"author": {
5454
"name": "Redis Ltd.",
5555
"email": "[email protected]",
5656
"url": "https://redis.com/redis-enterprise/redis-insight"
5757
},
5858
"bugs": {
59-
"url": "https://github.com/RedisLabs/redisinsight-v2/issues"
59+
"url": "https://github.com/RedisInsight/RedisInsight/issues"
6060
},
6161
"keywords": [
6262
"redisinsight",
@@ -68,7 +68,7 @@
6868
"sass",
6969
"webpack"
7070
],
71-
"homepage": "https://github.com/RedisLabs/redisinsight-v2#readme",
71+
"homepage": "https://github.com/RedisInsight/RedisInsight#readme",
7272
"jest": {
7373
"testURL": "http://localhost/",
7474
"moduleNameMapper": {

redisinsight/api/src/__mocks__/analytics.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ export const mockBrowserAnalyticsService = () => ({
2424
});
2525

2626
export const mockCliAnalyticsService = () => ({
27-
sendCliClientCreatedEvent: jest.fn(),
28-
sendCliClientCreationFailedEvent: jest.fn(),
29-
sendCliClientDeletedEvent: jest.fn(),
30-
sendCliClientRecreatedEvent: jest.fn(),
31-
sendCliCommandExecutedEvent: jest.fn(),
32-
sendCliCommandErrorEvent: jest.fn(),
33-
sendCliClusterCommandExecutedEvent: jest.fn(),
34-
sendCliConnectionErrorEvent: jest.fn(),
27+
sendClientCreatedEvent: jest.fn(),
28+
sendClientCreationFailedEvent: jest.fn(),
29+
sendClientDeletedEvent: jest.fn(),
30+
sendClientRecreatedEvent: jest.fn(),
31+
sendCommandExecutedEvent: jest.fn(),
32+
sendCommandErrorEvent: jest.fn(),
33+
sendClusterCommandExecutedEvent: jest.fn(),
34+
sendConnectionErrorEvent: jest.fn(),
3535
});
3636

3737
export const mockSettingsAnalyticsService = () => ({

redisinsight/api/src/constants/telemetry-events.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ export enum TelemetryEvents {
3939
BrowserJSONPropertyDeleted = 'BROWSER_JSON_PROPERTY_DELETED',
4040

4141
// Events for cli tool
42-
CliClientCreated = 'CLI_CLIENT_CREATED',
43-
CliClientCreationFailed = 'CLI_CLIENT_CREATION_FAILED',
44-
CliClientConnectionError = 'CLI_CLIENT_CONNECTION_ERROR',
45-
CliClientDeleted = 'CLI_CLIENT_DELETED',
46-
CliClientRecreated = 'CLI_CLIENT_RECREATED',
47-
CliCommandExecuted = 'CLI_COMMAND_EXECUTED',
48-
CliClusterNodeCommandExecuted = 'CLI_CLUSTER_COMMAND_EXECUTED',
49-
CliCommandErrorReceived = 'CLI_COMMAND_ERROR_RECEIVED',
42+
ClientCreated = 'CLIENT_CREATED',
43+
ClientCreationFailed = 'CLIENT_CREATION_FAILED',
44+
ClientConnectionError = 'CLIENT_CONNECTION_ERROR',
45+
ClientDeleted = 'CLIENT_DELETED',
46+
ClientRecreated = 'CLIENT_RECREATED',
47+
CommandExecuted = 'COMMAND_EXECUTED',
48+
ClusterNodeCommandExecuted = 'CLUSTER_COMMAND_EXECUTED',
49+
CommandErrorReceived = 'COMMAND_ERROR_RECEIVED',
5050
}

redisinsight/api/src/modules/cli/controllers/cli.controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ export class CliController {
132132
async reCreateClient(
133133
@Param('dbInstance') dbInstance: string,
134134
@Param('uuid') uuid: string,
135+
@Body() dto: CreateCliClientDto,
135136
): Promise<CreateCliClientResponse> {
136-
return this.service.reCreateClient(dbInstance, uuid);
137+
return this.service.reCreateClient(dbInstance, uuid, dto.namespace);
137138
}
138139
}

redisinsight/api/src/modules/cli/services/cli-analytics/cli-analytics.service.spec.ts

Lines changed: 73 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { EventEmitter2 } from '@nestjs/event-emitter';
33
import { InternalServerErrorException } from '@nestjs/common';
44
import { mockRedisWrongTypeError, mockStandaloneDatabaseEntity } from 'src/__mocks__';
55
import { TelemetryEvents } from 'src/constants';
6-
import { ReplyError } from 'src/models';
6+
import { AppTool, ReplyError } from 'src/models';
77
import { CliParsingError } from 'src/modules/cli/constants/errors';
88
import { ICliExecResultFromNode } from 'src/modules/cli/services/cli-tool/cli-tool.service';
99
import { CommandExecutionStatus } from 'src/modules/cli/dto/cli.dto';
@@ -42,21 +42,21 @@ describe('CliAnalyticsService', () => {
4242

4343
describe('sendCliClientCreatedEvent', () => {
4444
it('should emit CliClientCreated event', () => {
45-
service.sendCliClientCreatedEvent(instanceId, { data: 'Some data' });
45+
service.sendClientCreatedEvent(instanceId, AppTool.CLI, { data: 'Some data' });
4646

4747
expect(sendEventMethod).toHaveBeenCalledWith(
48-
TelemetryEvents.CliClientCreated,
48+
`CLI_${TelemetryEvents.ClientCreated}`,
4949
{
5050
databaseId: instanceId,
5151
data: 'Some data',
5252
},
5353
);
5454
});
5555
it('should emit CliClientCreated event without additional data', () => {
56-
service.sendCliClientCreatedEvent(instanceId);
56+
service.sendClientCreatedEvent(instanceId, AppTool.CLI);
5757

5858
expect(sendEventMethod).toHaveBeenCalledWith(
59-
TelemetryEvents.CliClientCreated,
59+
`CLI_${TelemetryEvents.ClientCreated}`,
6060
{
6161
databaseId: instanceId,
6262
},
@@ -66,10 +66,10 @@ describe('CliAnalyticsService', () => {
6666

6767
describe('sendCliClientCreationFailedEvent', () => {
6868
it('should emit CliClientCreationFailed event', () => {
69-
service.sendCliClientCreationFailedEvent(instanceId, httpException, { data: 'Some data' });
69+
service.sendClientCreationFailedEvent(instanceId, AppTool.CLI, httpException, { data: 'Some data' });
7070

7171
expect(sendFailedEventMethod).toHaveBeenCalledWith(
72-
TelemetryEvents.CliClientCreationFailed,
72+
`CLI_${TelemetryEvents.ClientCreationFailed}`,
7373
httpException,
7474
{
7575
databaseId: instanceId,
@@ -78,10 +78,10 @@ describe('CliAnalyticsService', () => {
7878
);
7979
});
8080
it('should emit CliClientCreationFailed event without additional data', () => {
81-
service.sendCliClientCreationFailedEvent(instanceId, httpException);
81+
service.sendClientCreationFailedEvent(instanceId, AppTool.CLI, httpException);
8282

8383
expect(sendFailedEventMethod).toHaveBeenCalledWith(
84-
TelemetryEvents.CliClientCreationFailed,
84+
`CLI_${TelemetryEvents.ClientCreationFailed}`,
8585
httpException,
8686
{
8787
databaseId: instanceId,
@@ -92,21 +92,21 @@ describe('CliAnalyticsService', () => {
9292

9393
describe('sendCliClientRecreatedEvent', () => {
9494
it('should emit CliClientRecreated event', () => {
95-
service.sendCliClientRecreatedEvent(instanceId, { data: 'Some data' });
95+
service.sendClientRecreatedEvent(instanceId, AppTool.CLI, { data: 'Some data' });
9696

9797
expect(sendEventMethod).toHaveBeenCalledWith(
98-
TelemetryEvents.CliClientRecreated,
98+
`CLI_${TelemetryEvents.ClientRecreated}`,
9999
{
100100
databaseId: instanceId,
101101
data: 'Some data',
102102
},
103103
);
104104
});
105105
it('should emit CliClientRecreated event without additional data', () => {
106-
service.sendCliClientRecreatedEvent(instanceId);
106+
service.sendClientRecreatedEvent(instanceId, AppTool.CLI);
107107

108108
expect(sendEventMethod).toHaveBeenCalledWith(
109-
TelemetryEvents.CliClientRecreated,
109+
`CLI_${TelemetryEvents.ClientRecreated}`,
110110
{
111111
databaseId: instanceId,
112112
},
@@ -116,57 +116,89 @@ describe('CliAnalyticsService', () => {
116116

117117
describe('sendCliClientDeletedEvent', () => {
118118
it('should emit CliClientDeleted event', () => {
119-
service.sendCliClientDeletedEvent(1, instanceId, { data: 'Some data' });
119+
service.sendClientDeletedEvent(1, instanceId, AppTool.CLI, { data: 'Some data' });
120120

121121
expect(sendEventMethod).toHaveBeenCalledWith(
122-
TelemetryEvents.CliClientDeleted,
122+
`CLI_${TelemetryEvents.ClientDeleted}`,
123123
{
124124
databaseId: instanceId,
125125
data: 'Some data',
126126
},
127127
);
128128
});
129129
it('should emit CliClientDeleted event without additional data', () => {
130-
service.sendCliClientDeletedEvent(1, instanceId);
130+
service.sendClientDeletedEvent(1, instanceId, AppTool.CLI);
131131

132132
expect(sendEventMethod).toHaveBeenCalledWith(
133-
TelemetryEvents.CliClientDeleted,
133+
`CLI_${TelemetryEvents.ClientDeleted}`,
134134
{
135135
databaseId: instanceId,
136136
},
137137
);
138138
});
139139
it('should not emit event', () => {
140-
service.sendCliClientDeletedEvent(0, instanceId);
140+
service.sendClientDeletedEvent(0, instanceId, AppTool.CLI);
141141

142142
expect(sendEventMethod).not.toHaveBeenCalled();
143143
});
144144
it('should not emit event on invalid input values', () => {
145145
const input: any = {};
146-
service.sendCliClientDeletedEvent(input, instanceId);
146+
service.sendClientDeletedEvent(input, instanceId, AppTool.CLI);
147147

148-
expect(() => service.sendCliClientDeletedEvent(input, instanceId)).not.toThrow();
148+
expect(() => service.sendClientDeletedEvent(input, instanceId, AppTool.CLI)).not.toThrow();
149149
expect(sendEventMethod).not.toHaveBeenCalled();
150150
});
151151
});
152152

153153
describe('sendCliCommandExecutedEvent', () => {
154154
it('should emit CliCommandExecuted event', () => {
155-
service.sendCliCommandExecutedEvent(instanceId, { command: 'info' });
155+
service.sendCommandExecutedEvent(instanceId, AppTool.CLI, { command: 'info' });
156156

157157
expect(sendEventMethod).toHaveBeenCalledWith(
158-
TelemetryEvents.CliCommandExecuted,
158+
`CLI_${TelemetryEvents.CommandExecuted}`,
159159
{
160160
databaseId: instanceId,
161161
command: 'info',
162162
},
163163
);
164164
});
165165
it('should emit CliCommandExecuted event without additional data', () => {
166-
service.sendCliCommandExecutedEvent(instanceId);
166+
service.sendCommandExecutedEvent(instanceId, AppTool.CLI);
167167

168168
expect(sendEventMethod).toHaveBeenCalledWith(
169-
TelemetryEvents.CliCommandExecuted,
169+
`CLI_${TelemetryEvents.CommandExecuted}`,
170+
{
171+
databaseId: instanceId,
172+
},
173+
);
174+
});
175+
it('should emit CliCommandExecuted for undefined namespace', () => {
176+
service.sendCommandExecutedEvent(instanceId, undefined, { command: 'info' });
177+
178+
expect(sendEventMethod).toHaveBeenCalledWith(
179+
`CLI_${TelemetryEvents.CommandExecuted}`,
180+
{
181+
databaseId: instanceId,
182+
command: 'info',
183+
},
184+
);
185+
});
186+
it('should emit WorkbenchCommandExecuted event', () => {
187+
service.sendCommandExecutedEvent(instanceId, 'workbench', { command: 'info' });
188+
189+
expect(sendEventMethod).toHaveBeenCalledWith(
190+
`WORKBENCH_${TelemetryEvents.CommandExecuted}`,
191+
{
192+
databaseId: instanceId,
193+
command: 'info',
194+
},
195+
);
196+
});
197+
it('should emit WorkbenchCommandExecuted event without additional data', () => {
198+
service.sendCommandExecutedEvent(instanceId, 'workbench');
199+
200+
expect(sendEventMethod).toHaveBeenCalledWith(
201+
`WORKBENCH_${TelemetryEvents.CommandExecuted}`,
170202
{
171203
databaseId: instanceId,
172204
},
@@ -176,10 +208,10 @@ describe('CliAnalyticsService', () => {
176208

177209
describe('sendCliCommandErrorEvent', () => {
178210
it('should emit CliCommandError event', () => {
179-
service.sendCliCommandErrorEvent(instanceId, redisReplyError, { data: 'Some data' });
211+
service.sendCommandErrorEvent(instanceId, AppTool.CLI, redisReplyError, { data: 'Some data' });
180212

181213
expect(sendEventMethod).toHaveBeenCalledWith(
182-
TelemetryEvents.CliCommandErrorReceived,
214+
`CLI_${TelemetryEvents.CommandErrorReceived}`,
183215
{
184216
databaseId: instanceId,
185217
error: ReplyError.name,
@@ -189,10 +221,10 @@ describe('CliAnalyticsService', () => {
189221
);
190222
});
191223
it('should emit CliCommandError event without additional data', () => {
192-
service.sendCliCommandErrorEvent(instanceId, redisReplyError);
224+
service.sendCommandErrorEvent(instanceId, AppTool.CLI, redisReplyError);
193225

194226
expect(sendEventMethod).toHaveBeenCalledWith(
195-
TelemetryEvents.CliCommandErrorReceived,
227+
`CLI_${TelemetryEvents.CommandErrorReceived}`,
196228
{
197229
databaseId: instanceId,
198230
error: ReplyError.name,
@@ -202,10 +234,10 @@ describe('CliAnalyticsService', () => {
202234
});
203235
it('should emit event for custom error', () => {
204236
const error: any = CliParsingError;
205-
service.sendCliCommandErrorEvent(instanceId, error);
237+
service.sendCommandErrorEvent(instanceId, AppTool.CLI, error);
206238

207239
expect(sendEventMethod).toHaveBeenCalledWith(
208-
TelemetryEvents.CliCommandErrorReceived,
240+
`CLI_${TelemetryEvents.CommandErrorReceived}`,
209241
{
210242
databaseId: instanceId,
211243
error: CliParsingError.name,
@@ -216,10 +248,10 @@ describe('CliAnalyticsService', () => {
216248

217249
describe('sendCliClientCreationFailedEvent', () => {
218250
it('should emit CliConnectionError event', () => {
219-
service.sendCliConnectionErrorEvent(instanceId, httpException, { data: 'Some data' });
251+
service.sendConnectionErrorEvent(instanceId, AppTool.CLI, httpException, { data: 'Some data' });
220252

221253
expect(sendFailedEventMethod).toHaveBeenCalledWith(
222-
TelemetryEvents.CliClientConnectionError,
254+
`CLI_${TelemetryEvents.ClientConnectionError}`,
223255
httpException,
224256
{
225257
databaseId: instanceId,
@@ -228,10 +260,10 @@ describe('CliAnalyticsService', () => {
228260
);
229261
});
230262
it('should emit CliConnectionError event without additional data', () => {
231-
service.sendCliConnectionErrorEvent(instanceId, httpException);
263+
service.sendConnectionErrorEvent(instanceId, AppTool.CLI, httpException);
232264

233265
expect(sendFailedEventMethod).toHaveBeenCalledWith(
234-
TelemetryEvents.CliClientConnectionError,
266+
`CLI_${TelemetryEvents.ClientConnectionError}`,
235267
httpException,
236268
{
237269
databaseId: instanceId,
@@ -249,10 +281,10 @@ describe('CliAnalyticsService', () => {
249281
status: CommandExecutionStatus.Success,
250282
};
251283

252-
service.sendCliClusterCommandExecutedEvent(instanceId, nodExecResult, { command: 'sadd' });
284+
service.sendClusterCommandExecutedEvent(instanceId, AppTool.CLI, nodExecResult, { command: 'sadd' });
253285

254286
expect(sendEventMethod).toHaveBeenCalledWith(
255-
TelemetryEvents.CliClusterNodeCommandExecuted,
287+
`CLI_${TelemetryEvents.ClusterNodeCommandExecuted}`,
256288
{
257289
databaseId: instanceId,
258290
command: 'sadd',
@@ -268,10 +300,10 @@ describe('CliAnalyticsService', () => {
268300
status: CommandExecutionStatus.Fail,
269301
};
270302

271-
service.sendCliClusterCommandExecutedEvent(instanceId, nodExecResult);
303+
service.sendClusterCommandExecutedEvent(instanceId, AppTool.CLI, nodExecResult);
272304

273305
expect(sendEventMethod).toHaveBeenCalledWith(
274-
TelemetryEvents.CliCommandErrorReceived,
306+
`CLI_${TelemetryEvents.CommandErrorReceived}`,
275307
{
276308
databaseId: instanceId,
277309
error: redisReplyError.name,
@@ -288,10 +320,10 @@ describe('CliAnalyticsService', () => {
288320
status: CommandExecutionStatus.Fail,
289321
};
290322

291-
service.sendCliClusterCommandExecutedEvent(instanceId, nodExecResult);
323+
service.sendClusterCommandExecutedEvent(instanceId, AppTool.CLI, nodExecResult);
292324

293325
expect(sendEventMethod).toHaveBeenCalledWith(
294-
TelemetryEvents.CliCommandErrorReceived,
326+
`CLI_${TelemetryEvents.CommandErrorReceived}`,
295327
{
296328
databaseId: instanceId,
297329
error: CliParsingError.name,
@@ -305,7 +337,7 @@ describe('CliAnalyticsService', () => {
305337
port: 7002,
306338
status: 'undefined status',
307339
};
308-
service.sendCliClusterCommandExecutedEvent(instanceId, nodExecResult);
340+
service.sendClusterCommandExecutedEvent(instanceId, AppTool.CLI, nodExecResult);
309341

310342
expect(sendEventMethod).not.toHaveBeenCalled();
311343
});

0 commit comments

Comments
 (0)