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
2 changes: 1 addition & 1 deletion redisinsight/api/config/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default {
url: process.env.RI_FEATURES_CONFIG_URL
// eslint-disable-next-line max-len
|| 'https://raw.githubusercontent.com/RedisInsight/RedisInsight/main/redisinsight/api/config/features-config.json',
syncInterval: parseInt(process.env.RI_FEATURES_CONFIG_SYNC_INTERVAL, 10) || 1_000 * 60 * 60 * 4, // 4h
syncInterval: parseInt(process.env.RI_FEATURES_CONFIG_SYNC_INTERVAL, 10) || 1_000 * 60 * 60 * 24, // 24h
},
cloud: {
apiUrl: process.env.RI_CLOUD_API_URL || 'https://app-sm.k8s-cloudapi.sm-qa.qa.redislabs.com/api/v1',
Expand Down
1 change: 0 additions & 1 deletion redisinsight/api/src/constants/telemetry-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export enum TelemetryEvents {
RedisInstanceDeleted = 'CONFIG_DATABASES_DATABASE_DELETED',
RedisInstanceEditedByUser = 'CONFIG_DATABASES_DATABASE_EDITED_BY_USER',
RedisInstanceConnectionFailed = 'DATABASE_CONNECTION_FAILED',
RedisInstanceListReceived = 'CONFIG_DATABASES_DATABASE_LIST_DISPLAYED',

// Databases import
DatabaseImportParseFailed = 'CONFIG_DATABASES_REDIS_IMPORT_PARSE_FAILED',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,54 +30,6 @@ describe('DatabaseAnalytics', () => {
sendFailedEventSpy = jest.spyOn(service as any, 'sendFailedEvent');
});

describe('sendInstanceListReceivedEvent', () => {
it('should emit event with one db in the list', () => {
service.sendInstanceListReceivedEvent([mockDatabaseWithTlsAuth]);

expect(sendEventSpy).toHaveBeenCalledWith(
TelemetryEvents.RedisInstanceListReceived,
{
numberOfDatabases: 1,
},
);
});
it('should emit event with several dbs in the list', () => {
service.sendInstanceListReceivedEvent([
mockDatabaseWithTlsAuth,
mockDatabaseWithTlsAuth,
mockDatabaseWithTlsAuth,
]);

expect(sendEventSpy).toHaveBeenCalledWith(
TelemetryEvents.RedisInstanceListReceived,
{
numberOfDatabases: 3,
},
);
});
it('should emit event with several empty in the list', () => {
service.sendInstanceListReceivedEvent([]);

expect(sendEventSpy).toHaveBeenCalledWith(
TelemetryEvents.RedisInstanceListReceived,
{
numberOfDatabases: 0,
},
);
});
it('should emit event with additional data', () => {
service.sendInstanceListReceivedEvent([], { data: 'data' });

expect(sendEventSpy).toHaveBeenCalledWith(
TelemetryEvents.RedisInstanceListReceived,
{
numberOfDatabases: 0,
data: 'data',
},
);
});
});

describe('sendInstanceAddedEvent', () => {
it('should emit event with enabled tls and sni, and ssh', () => {
service.sendInstanceAddedEvent({
Expand Down
17 changes: 0 additions & 17 deletions redisinsight/api/src/modules/database/database.analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@ export class DatabaseAnalytics extends TelemetryBaseService {
super(eventEmitter);
}

sendInstanceListReceivedEvent(
databases: Database[],
additionalData: object = {},
): void {
try {
this.sendEvent(
TelemetryEvents.RedisInstanceListReceived,
{
numberOfDatabases: databases.length,
...additionalData,
},
);
} catch (e) {
// continue regardless of error
}
}

sendConnectionFailedEvent(instance: Database, exception: HttpException): void {
this.sendFailedEvent(
TelemetryEvents.RedisInstanceConnectionFailed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,10 @@ describe('DatabaseService', () => {
it('should return databases and send analytics event', async () => {
databaseRepository.list.mockResolvedValue([mockDatabase, mockDatabase]);
expect(await service.list()).toEqual([mockDatabase, mockDatabase]);
expect(analytics.sendInstanceListReceivedEvent).toHaveBeenCalledWith([mockDatabase, mockDatabase]);
});
it('should throw InternalServerErrorException?', async () => {
databaseRepository.list.mockRejectedValueOnce(new Error());
await expect(service.list()).rejects.toThrow(InternalServerErrorException);
expect(analytics.sendInstanceListReceivedEvent).not.toHaveBeenCalled();
});
});

Expand Down
4 changes: 1 addition & 3 deletions redisinsight/api/src/modules/database/database.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ export class DatabaseService {
async list(): Promise<Database[]> {
try {
this.logger.log('Getting databases list');
const result = await this.repository.list();
this.analytics.sendInstanceListReceivedEvent(result);
return result;
return await this.repository.list();
} catch (e) {
this.logger.error('Failed to get database instance list.', e);
throw new InternalServerErrorException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { initialKeyInfo, keysSelector, selectedKeyDataSelector, selectedKeySelec
import { streamSelector } from 'uiSrc/slices/browser/stream'
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
import { RedisResponseBuffer } from 'uiSrc/slices/interfaces'
import { getBasedOnViewTypeEvent, getRefreshEventData, sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { getBasedOnViewTypeEvent, sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import {
formatBytes,
formatLongName,
Expand Down Expand Up @@ -208,25 +208,7 @@ const KeyDetailsHeader = ({
})
}

const handleRefreshKey = (enableAutoRefresh: boolean) => {
if (!enableAutoRefresh) {
const eventData = getRefreshEventData(
{
databaseId: instanceId,
keyType: type
},
type,
streamViewType
)
sendEventTelemetry({
event: getBasedOnViewTypeEvent(
viewType,
TelemetryEvent.BROWSER_KEY_DETAILS_REFRESH_CLICKED,
TelemetryEvent.TREE_VIEW_KEY_DETAILS_REFRESH_CLICKED
),
eventData
})
}
const handleRefreshKey = () => {
onRefresh(keyBuffer, type)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,7 @@ const KeysHeader = (props: Props) => {
height: '36px !important',
}

const handleRefreshKeys = (enableAutoRefresh: boolean) => {
if (!enableAutoRefresh) {
sendEventTelemetry({
event: getBasedOnViewTypeEvent(
viewType,
TelemetryEvent.BROWSER_KEY_LIST_REFRESH_CLICKED,
TelemetryEvent.TREE_VIEW_KEY_LIST_REFRESH_CLICKED
),
eventData: {
databaseId: instanceId
}
})
}
const handleRefreshKeys = () => {
dispatch(fetchKeys(
{
searchMode,
Expand Down
39 changes: 0 additions & 39 deletions redisinsight/ui/src/slices/browser/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,21 +562,6 @@ export function fetchPatternKeysAction(
}
})
}
if (!type && !match && cursor === '0') {
sendEventTelemetry({
event: getBasedOnViewTypeEvent(
state.browser.keys?.viewType,
TelemetryEvent.BROWSER_KEYS_SCANNED,
TelemetryEvent.TREE_VIEW_KEYS_SCANNED
),
eventData: {
databaseId: state.connections.instances?.connectedInstance?.id,
databaseSize: data[0].total,
numberOfKeysScanned: data[0].scanned,
scanCount: count,
}
})
}
onSuccess?.(data)
}
} catch (error) {
Expand Down Expand Up @@ -879,18 +864,6 @@ export function deleteSelectedKeyAction(
)

if (isStatusSuccessful(status)) {
sendEventTelemetry({
event: getBasedOnViewTypeEvent(
state.browser.keys?.viewType,
TelemetryEvent.BROWSER_KEYS_DELETED,
TelemetryEvent.TREE_VIEW_KEYS_DELETED
),
eventData: {
databaseId: state.connections.instances?.connectedInstance?.id,
numberOfDeletedKeys: 1,
source: 'keyValue',
}
})
dispatch(deleteSelectedKeySuccess())
dispatch<any>(deleteKeyFromList(key))
onSuccessAction?.()
Expand Down Expand Up @@ -926,18 +899,6 @@ export function deleteKeyAction(
)

if (isStatusSuccessful(status)) {
sendEventTelemetry({
event: getBasedOnViewTypeEvent(
state.browser.keys?.viewType,
TelemetryEvent.BROWSER_KEYS_DELETED,
TelemetryEvent.TREE_VIEW_KEYS_DELETED
),
eventData: {
databaseId: state.connections.instances?.connectedInstance?.id,
numberOfDeletedKeys: 1,
source: 'keyList',
}
})
dispatch(deleteKeySuccess())
dispatch<any>(deleteKeyFromList(key))
onSuccessAction?.()
Expand Down
8 changes: 0 additions & 8 deletions redisinsight/ui/src/telemetry/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export enum TelemetryEvent {
BROWSER_KEY_BULK_ACTIONS_BUTTON_CLICKED = 'BROWSER_KEY_BULK_ACTIONS_BUTTON_CLICKED',
BROWSER_KEY_ADD_CANCELLED = 'BROWSER_KEY_ADD_CANCELLED',
BROWSER_KEY_DELETE_CLICKED = 'BROWSER_KEY_DELETE_CLICKED',
BROWSER_KEY_LIST_REFRESH_CLICKED = 'BROWSER_KEY_LIST_REFRESH_CLICKED',
BROWSER_KEY_DETAILS_REFRESH_CLICKED = 'BROWSER_KEY_DETAILS_REFRESH_CLICKED',
BROWSER_KEY_VALUE_REMOVE_CLICKED = 'BROWSER_KEY_VALUE_REMOVE_CLICKED',
BROWSER_KEY_ADD_VALUE_CLICKED = 'BROWSER_KEY_ADD_VALUE_CLICKED',
BROWSER_KEY_ADD_VALUE_CANCELLED = 'BROWSER_KEY_ADD_VALUE_CANCELLED',
Expand All @@ -58,12 +56,10 @@ export enum TelemetryEvent {
BROWSER_KEY_VALUE_ADDED = 'BROWSER_KEY_VALUE_ADDED',
BROWSER_KEY_VALUE_REMOVED = 'BROWSER_KEY_VALUE_REMOVED',
BROWSER_KEY_VALUE_EDITED = 'BROWSER_KEY_VALUE_EDITED',
BROWSER_KEYS_DELETED = 'BROWSER_KEYS_DELETED',
BROWSER_JSON_PROPERTY_EDITED = 'BROWSER_JSON_PROPERTY_EDITED',
BROWSER_JSON_PROPERTY_DELETED = 'BROWSER_JSON_PROPERTY_DELETED',
BROWSER_JSON_PROPERTY_ADDED = 'BROWSER_JSON_PROPERTY_ADDED',
BROWSER_JSON_VALUE_IMPORT_CLICKED = 'BROWSER_JSON_VALUE_IMPORT_CLICKED',
BROWSER_KEYS_SCANNED = 'BROWSER_KEYS_SCANNED',
BROWSER_KEYS_ADDITIONALLY_SCANNED = 'BROWSER_KEYS_ADDITIONALLY_SCANNED',
BROWSER_KEYS_SCANNED_WITH_FILTER_ENABLED = 'BROWSER_KEYS_SCANNED_WITH_FILTER_ENABLED',
BROWSER_KEY_LIST_AUTO_REFRESH_ENABLED = 'BROWSER_KEY_LIST_AUTO_REFRESH_ENABLED',
Expand Down Expand Up @@ -150,19 +146,15 @@ export enum TelemetryEvent {
TREE_VIEW_KEY_VALUE_ADDED = 'TREE_VIEW_KEY_VALUE_ADDED',
TREE_VIEW_KEY_VALUE_REMOVE_CLICKED = 'TREE_VIEW_KEY_VALUE_REMOVE_CLICKED',
TREE_VIEW_KEY_DELETE_CLICKED = 'TREE_VIEW_KEY_DELETE_CLICKED',
TREE_VIEW_KEY_LIST_REFRESH_CLICKED = 'TREE_VIEW_KEY_LIST_REFRESH_CLICKED',
TREE_VIEW_KEY_DETAILS_REFRESH_CLICKED = 'TREE_VIEW_KEY_DETAILS_REFRESH_CLICKED',
TREE_VIEW_KEY_VALUE_REMOVED = 'TREE_VIEW_KEY_VALUE_REMOVED',
TREE_VIEW_KEY_VALUE_EDITED = 'TREE_VIEW_KEY_VALUE_EDITED',
TREE_VIEW_KEYS_DELETED = 'TREE_VIEW_KEYS_DELETED',
TREE_VIEW_KEY_COPIED = 'TREE_VIEW_KEY_COPIED',
TREE_VIEW_JSON_KEY_EXPANDED = 'TREE_VIEW_JSON_KEY_EXPANDED',
TREE_VIEW_JSON_KEY_COLLAPSED = 'TREE_VIEW_JSON_KEY_COLLAPSED',
TREE_VIEW_JSON_PROPERTY_EDITED = 'TREE_VIEW_JSON_PROPERTY_EDITED',
TREE_VIEW_JSON_PROPERTY_DELETED = 'TREE_VIEW_JSON_PROPERTY_DELETED',
TREE_VIEW_JSON_PROPERTY_ADDED = 'TREE_VIEW_JSON_PROPERTY_ADDED',
TREE_VIEW_KEYS_SCANNED_WITH_FILTER_ENABLED = 'TREE_VIEW_KEYS_SCANNED_WITH_FILTER_ENABLED',
TREE_VIEW_KEYS_SCANNED = 'TREE_VIEW_KEYS_SCANNED',
TREE_VIEW_KEYS_ADDITIONALLY_SCANNED = 'TREE_VIEW_KEYS_ADDITIONALLY_SCANNED',
TREE_VIEW_DELIMITER_CHANGED = 'TREE_VIEW_DELIMITER_CHANGED',
TREE_VIEW_KEY_ADDED = 'TREE_VIEW_KEY_ADDED',
Expand Down
10 changes: 0 additions & 10 deletions redisinsight/ui/src/telemetry/telemetryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,6 @@ const getMatchType = (match: string): MatchType => (
: MatchType.PATTERN
)

export const getRefreshEventData = (eventData: any, type: string, streamViewType?: StreamViewType) => {
if (type === KeyTypes.Stream) {
return {
...eventData,
streamView: StreamViews[streamViewType!]
}
}
return eventData
}

const SUPPORTED_REDIS_MODULES = Object.freeze({
ai: RedisModules.RedisAI,
graph: RedisModules.RedisGraph,
Expand Down