Skip to content

Commit 59fd06b

Browse files
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight into be/bugfix/RI-4882_modules_import
2 parents bc769e4 + bdeda3f commit 59fd06b

File tree

37 files changed

+141
-254
lines changed

37 files changed

+141
-254
lines changed

redisinsight/api/config/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export default {
212212
url: process.env.RI_FEATURES_CONFIG_URL
213213
// eslint-disable-next-line max-len
214214
|| 'https://raw.githubusercontent.com/RedisInsight/RedisInsight/main/redisinsight/api/config/features-config.json',
215-
syncInterval: parseInt(process.env.RI_FEATURES_CONFIG_SYNC_INTERVAL, 10) || 1_000 * 60 * 60 * 4, // 4h
215+
syncInterval: parseInt(process.env.RI_FEATURES_CONFIG_SYNC_INTERVAL, 10) || 1_000 * 60 * 60 * 24, // 24h
216216
},
217217
cloud: {
218218
apiUrl: process.env.RI_CLOUD_API_URL || 'https://app-sm.k8s-cloudapi.sm-qa.qa.redislabs.com/api/v1',

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export enum TelemetryEvents {
1313
RedisInstanceDeleted = 'CONFIG_DATABASES_DATABASE_DELETED',
1414
RedisInstanceEditedByUser = 'CONFIG_DATABASES_DATABASE_EDITED_BY_USER',
1515
RedisInstanceConnectionFailed = 'DATABASE_CONNECTION_FAILED',
16-
RedisInstanceListReceived = 'CONFIG_DATABASES_DATABASE_LIST_DISPLAYED',
1716

1817
// Databases import
1918
DatabaseImportParseFailed = 'CONFIG_DATABASES_REDIS_IMPORT_PARSE_FAILED',

redisinsight/api/src/modules/database/database.analytics.spec.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -30,54 +30,6 @@ describe('DatabaseAnalytics', () => {
3030
sendFailedEventSpy = jest.spyOn(service as any, 'sendFailedEvent');
3131
});
3232

33-
describe('sendInstanceListReceivedEvent', () => {
34-
it('should emit event with one db in the list', () => {
35-
service.sendInstanceListReceivedEvent([mockDatabaseWithTlsAuth]);
36-
37-
expect(sendEventSpy).toHaveBeenCalledWith(
38-
TelemetryEvents.RedisInstanceListReceived,
39-
{
40-
numberOfDatabases: 1,
41-
},
42-
);
43-
});
44-
it('should emit event with several dbs in the list', () => {
45-
service.sendInstanceListReceivedEvent([
46-
mockDatabaseWithTlsAuth,
47-
mockDatabaseWithTlsAuth,
48-
mockDatabaseWithTlsAuth,
49-
]);
50-
51-
expect(sendEventSpy).toHaveBeenCalledWith(
52-
TelemetryEvents.RedisInstanceListReceived,
53-
{
54-
numberOfDatabases: 3,
55-
},
56-
);
57-
});
58-
it('should emit event with several empty in the list', () => {
59-
service.sendInstanceListReceivedEvent([]);
60-
61-
expect(sendEventSpy).toHaveBeenCalledWith(
62-
TelemetryEvents.RedisInstanceListReceived,
63-
{
64-
numberOfDatabases: 0,
65-
},
66-
);
67-
});
68-
it('should emit event with additional data', () => {
69-
service.sendInstanceListReceivedEvent([], { data: 'data' });
70-
71-
expect(sendEventSpy).toHaveBeenCalledWith(
72-
TelemetryEvents.RedisInstanceListReceived,
73-
{
74-
numberOfDatabases: 0,
75-
data: 'data',
76-
},
77-
);
78-
});
79-
});
80-
8133
describe('sendInstanceAddedEvent', () => {
8234
it('should emit event with enabled tls and sni, and ssh', () => {
8335
service.sendInstanceAddedEvent({

redisinsight/api/src/modules/database/database.analytics.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,6 @@ export class DatabaseAnalytics extends TelemetryBaseService {
1313
super(eventEmitter);
1414
}
1515

16-
sendInstanceListReceivedEvent(
17-
databases: Database[],
18-
additionalData: object = {},
19-
): void {
20-
try {
21-
this.sendEvent(
22-
TelemetryEvents.RedisInstanceListReceived,
23-
{
24-
numberOfDatabases: databases.length,
25-
...additionalData,
26-
},
27-
);
28-
} catch (e) {
29-
// continue regardless of error
30-
}
31-
}
32-
3316
sendConnectionFailedEvent(instance: Database, exception: HttpException): void {
3417
this.sendFailedEvent(
3518
TelemetryEvents.RedisInstanceConnectionFailed,

redisinsight/api/src/modules/database/database.service.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@ describe('DatabaseService', () => {
9797
it('should return databases and send analytics event', async () => {
9898
databaseRepository.list.mockResolvedValue([mockDatabase, mockDatabase]);
9999
expect(await service.list()).toEqual([mockDatabase, mockDatabase]);
100-
expect(analytics.sendInstanceListReceivedEvent).toHaveBeenCalledWith([mockDatabase, mockDatabase]);
101100
});
102101
it('should throw InternalServerErrorException?', async () => {
103102
databaseRepository.list.mockRejectedValueOnce(new Error());
104103
await expect(service.list()).rejects.toThrow(InternalServerErrorException);
105-
expect(analytics.sendInstanceListReceivedEvent).not.toHaveBeenCalled();
106104
});
107105
});
108106

redisinsight/api/src/modules/database/database.service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ export class DatabaseService {
6363
async list(): Promise<Database[]> {
6464
try {
6565
this.logger.log('Getting databases list');
66-
const result = await this.repository.list();
67-
this.analytics.sendInstanceListReceivedEvent(result);
68-
return result;
66+
return await this.repository.list();
6967
} catch (e) {
7068
this.logger.error('Failed to get database instance list.', e);
7169
throw new InternalServerErrorException();

redisinsight/api/src/modules/slow-log/slow-log-analytics.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ export class SlowLogAnalyticsService extends TelemetryBaseService {
3737
TelemetryEvents.SlowlogSetLogSlowerThan,
3838
{
3939
databaseId,
40-
previousValue,
41-
currentValue,
40+
// convert microseconds to milliseconds
41+
previousValueInMSeconds: previousValue / 1_000,
42+
currentValueInMSeconds: currentValue / 1_000,
4243
},
4344
);
4445
}

redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('QueryCardHeader', () => {
5656
})
5757
await waitForEuiToolTipVisible()
5858

59-
expect(screen.getByTestId('execution-time-tooltip')).toHaveTextContent('12 345 678.91 ms')
59+
expect(screen.getByTestId('execution-time-tooltip')).toHaveTextContent('12 345 678.91 msec')
6060
})
6161

6262
it('should render disabled copy button', async () => {

redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ export interface Props {
7676

7777
const getExecutionTimeString = (value: number): string => {
7878
if (value < 1) {
79-
return '0.001 ms'
79+
return '0.001 msec'
8080
}
81-
return `${numberWithSpaces((parseFloat((value / 1000).toFixed(3))))} ms`
81+
return `${numberWithSpaces((parseFloat((value / 1000).toFixed(3))))} msec`
8282
}
8383

8484
const getTruncatedExecutionTimeString = (value: number): string => {
8585
if (value < 1) {
86-
return '0.001 ms'
86+
return '0.001 msec'
8787
}
8888

8989
return truncateMilliseconds(parseFloat((value / 1000).toFixed(3)))

redisinsight/ui/src/constants/durationUnits.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { EuiSuperSelectOption } from '@elastic/eui'
22

33
export enum DurationUnits {
44
microSeconds = 'µs',
5-
milliSeconds = 'ms'
5+
milliSeconds = 'ms',
6+
mSeconds = 'msec',
67
}
78

89
export const DURATION_UNITS: EuiSuperSelectOption<DurationUnits>[] = [
@@ -12,15 +13,15 @@ export const DURATION_UNITS: EuiSuperSelectOption<DurationUnits>[] = [
1213
'data-test-subj': 'unit-micro-second',
1314
},
1415
{
15-
inputDisplay: DurationUnits.milliSeconds,
16+
inputDisplay: 'msec',
1617
value: DurationUnits.milliSeconds,
1718
'data-test-subj': 'unit-milli-second',
1819
},
1920
]
2021

2122
export const MINUS_ONE = -1
2223
export const DEFAULT_SLOWLOG_MAX_LEN = 128
23-
export const DEFAULT_SLOWLOG_SLOWER_THAN = 10_000
24-
export const DEFAULT_SLOWLOG_DURATION_UNIT = DurationUnits.microSeconds
24+
export const DEFAULT_SLOWLOG_SLOWER_THAN = 10
25+
export const DEFAULT_SLOWLOG_DURATION_UNIT = DurationUnits.milliSeconds
2526

2627
export default DURATION_UNITS

0 commit comments

Comments
 (0)