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
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class UpdateProviderNames1755086732238 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
UPDATE database_instance
SET provider = CASE provider
WHEN 'RE_CLOUD' THEN 'REDIS_CLOUD'
WHEN 'RE_CLUSTER' THEN 'REDIS_SOFTWARE'
WHEN 'REDIS_ENTERPRISE' THEN 'OTHER_REDIS_MANAGED'
ELSE provider
END
WHERE provider IN ('RE_CLOUD', 'RE_CLUSTER', 'REDIS_ENTERPRISE');
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
UPDATE database_instance
SET provider = CASE provider
WHEN 'REDIS_CLOUD' THEN 'RE_CLOUD'
WHEN 'REDIS_SOFTWARE' THEN 'RE_CLUSTER'
WHEN 'OTHER_REDIS_MANAGED' THEN 'REDIS_ENTERPRISE'
ELSE provider
END
WHERE provider IN ('REDIS_CLOUD', 'REDIS_SOFTWARE', 'OTHER_REDIS_MANAGED');
`);
}
}
2 changes: 2 additions & 0 deletions redisinsight/api/migration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { PreSetupDatabases1741786803681 } from './1741786803681-pre-setup-databa
import { KeyNameFormatAdded1742303245547 } from './1742303245547-key-name-format';
import { CascadeTags1743432519891 } from './1743432519891-cascade-tags';
import { EncryptTags1743606395647 } from './1743606395647-encrypt-tags';
import { UpdateProviderNames1755086732238 } from './1755086732238-update-provider-names';

export default [
initialMigration1614164490968,
Expand Down Expand Up @@ -110,4 +111,5 @@ export default [
KeyNameFormatAdded1742303245547,
CascadeTags1743432519891,
EncryptTags1743606395647,
UpdateProviderNames1755086732238,
];
8 changes: 4 additions & 4 deletions redisinsight/api/src/__mocks__/cloud-autodiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export const mockCloudAutodiscoveryService = jest.fn(() => ({
}));

export const mockCloudAutodiscoveryAnalytics = jest.fn(() => ({
sendGetRECloudSubsSucceedEvent: jest.fn(),
sendGetRECloudSubsFailedEvent: jest.fn(),
sendGetRECloudDbsSucceedEvent: jest.fn(),
sendGetRECloudDbsFailedEvent: jest.fn(),
sendGetRedisCloudSubsSucceedEvent: jest.fn(),
sendGetRedisCloudSubsFailedEvent: jest.fn(),
sendGetRedisCloudDbsSucceedEvent: jest.fn(),
sendGetRedisCloudDbsFailedEvent: jest.fn(),
}));
4 changes: 2 additions & 2 deletions redisinsight/api/src/__mocks__/redis-enterprise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const mockAddRedisEnterpriseDatabasesDto = Object.assign(
);

export const mockRedisEnterpriseAnalytics = jest.fn(() => ({
sendGetREClusterDbsSucceedEvent: jest.fn(),
sendGetREClusterDbsFailedEvent: jest.fn(),
sendGetRedisSoftwareDbsSucceedEvent: jest.fn(),
sendGetRedisSoftwareDbsFailedEvent: jest.fn(),
}));

export const mockRedisEnterpriseService = jest.fn(() => ({
Expand Down
4 changes: 2 additions & 2 deletions redisinsight/api/src/constants/redis-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const SUPPORTED_REDIS_MODULES = Object.freeze({
timeseries: AdditionalRedisModuleName.RedisTimeSeries,
});

export const RE_CLOUD_MODULES_NAMES = Object.freeze({
export const REDIS_CLOUD_MODULES_NAMES = Object.freeze({
RedisAI: AdditionalRedisModuleName.RedisAI,
RedisGraph: AdditionalRedisModuleName.RedisGraph,
RedisGears: AdditionalRedisModuleName.RedisGears,
Expand All @@ -34,7 +34,7 @@ export const RE_CLOUD_MODULES_NAMES = Object.freeze({
RedisTimeSeries: AdditionalRedisModuleName.RedisTimeSeries,
});

export const RE_CLUSTER_MODULES_NAMES = Object.freeze({
export const REDIS_SOFTWARE_MODULES_NAMES = Object.freeze({
ai: AdditionalRedisModuleName.RedisAI,
graph: AdditionalRedisModuleName.RedisGraph,
gears: AdditionalRedisModuleName.RedisGears,
Expand Down
12 changes: 6 additions & 6 deletions redisinsight/api/src/constants/telemetry-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export enum TelemetryEvents {
DatabaseImportPartiallySucceeded = 'CONFIG_DATABASES_REDIS_IMPORT_PARTIALLY_SUCCEEDED',

// Events for autodiscovery flows
REClusterDiscoverySucceed = 'CONFIG_DATABASES_RE_CLUSTER_AUTODISCOVERY_SUCCEEDED',
REClusterDiscoveryFailed = 'CONFIG_DATABASES_RE_CLUSTER_AUTODISCOVERY_FAILED',
RECloudSubscriptionsDiscoverySucceed = 'CONFIG_DATABASES_RE_CLOUD_AUTODISCOVERY_SUBSCRIPTIONS_SUCCEEDED',
RECloudSubscriptionsDiscoveryFailed = 'CONFIG_DATABASES_RE_CLOUD_AUTODISCOVERY_SUBSCRIPTIONS_FAILED',
RECloudDatabasesDiscoverySucceed = 'CONFIG_DATABASES_RE_CLOUD_AUTODISCOVERY_DATABASES_SUCCEEDED',
RECloudDatabasesDiscoveryFailed = 'CONFIG_DATABASES_RE_CLOUD_AUTODISCOVERY_DATABASES_FAILED',
RedisSoftwareDiscoverySucceed = 'CONFIG_DATABASES_REDIS_SOFTWARE_AUTODISCOVERY_SUCCEEDED',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: I might be missing something here, but why change both the constant names and their values? Usually, we use constants to hide the magic strings so we don’t need to update the whole codebase later. Or in this case, were the names actually wrong/misleading and needed to be updated too?

PS: Since you already made the effort to migrate everything, don't make any further changes, I'm just curious 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get your point and it makes sense for constants name to stay in general, but maybe if the constant name was descriptive and general enough, but this "RECloud" part I think it is both not descriptive and will look like a leftover we wouldn't have cleaned, at least to me ...

RedisSoftwareDiscoveryFailed = 'CONFIG_DATABASES_REDIS_SOFTWARE_AUTODISCOVERY_FAILED',
RedisCloudSubscriptionsDiscoverySucceed = 'CONFIG_DATABASES_REDIS_CLOUD_AUTODISCOVERY_SUBSCRIPTIONS_SUCCEEDED',
RedisCloudSubscriptionsDiscoveryFailed = 'CONFIG_DATABASES_REDIS_CLOUD_AUTODISCOVERY_SUBSCRIPTIONS_FAILED',
RedisCloudDatabasesDiscoverySucceed = 'CONFIG_DATABASES_REDIS_CLOUD_AUTODISCOVERY_DATABASES_SUCCEEDED',
RedisCloudDatabasesDiscoveryFailed = 'CONFIG_DATABASES_REDIS_CLOUD_AUTODISCOVERY_DATABASES_FAILED',
SentinelMasterGroupsDiscoverySucceed = 'CONFIG_DATABASES_REDIS_SENTINEL_AUTODISCOVERY_SUCCEEDED',
SentinelMasterGroupsDiscoveryFailed = 'CONFIG_DATABASES_REDIS_SENTINEL_AUTODISCOVERY_FAILED',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('CloudAuthAnalytics', () => {
});
});

describe('sendGetRECloudSubsFailedEvent', () => {
describe('sendGetRedisCloudSubsFailedEvent', () => {
it('should emit error event with deep link flow', () => {
service.sendCloudSignInFailed(
mockSessionMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ describe('CloudAutodiscoveryAnalytics', () => {
);
});

describe('sendGetRECloudSubsSucceedEvent', () => {
describe('sendGetRedisCloudSubsSucceedEvent', () => {
it('should emit event with active subscriptions', () => {
service.sendGetRECloudSubsSucceedEvent(
service.sendGetRedisCloudSubsSucceedEvent(
mockSessionMetadata,
[mockCloudSubscription, mockCloudSubscription],
CloudSubscriptionType.Flexible,
Expand All @@ -49,7 +49,7 @@ describe('CloudAutodiscoveryAnalytics', () => {

expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudSubscriptionsDiscoverySucceed,
TelemetryEvents.RedisCloudSubscriptionsDiscoverySucceed,
{
numberOfActiveSubscriptions: 2,
totalNumberOfSubscriptions: 2,
Expand All @@ -59,7 +59,7 @@ describe('CloudAutodiscoveryAnalytics', () => {
);
});
it('should emit event with active and not active subscription', () => {
service.sendGetRECloudSubsSucceedEvent(
service.sendGetRedisCloudSubsSucceedEvent(
mockSessionMetadata,
[
{
Expand All @@ -74,7 +74,7 @@ describe('CloudAutodiscoveryAnalytics', () => {

expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudSubscriptionsDiscoverySucceed,
TelemetryEvents.RedisCloudSubscriptionsDiscoverySucceed,
{
numberOfActiveSubscriptions: 1,
totalNumberOfSubscriptions: 2,
Expand All @@ -84,7 +84,7 @@ describe('CloudAutodiscoveryAnalytics', () => {
);
});
it('should emit event without active subscriptions', () => {
service.sendGetRECloudSubsSucceedEvent(
service.sendGetRedisCloudSubsSucceedEvent(
mockSessionMetadata,
[
{
Expand All @@ -101,7 +101,7 @@ describe('CloudAutodiscoveryAnalytics', () => {
);
expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudSubscriptionsDiscoverySucceed,
TelemetryEvents.RedisCloudSubscriptionsDiscoverySucceed,
{
numberOfActiveSubscriptions: 0,
totalNumberOfSubscriptions: 2,
Expand All @@ -110,8 +110,8 @@ describe('CloudAutodiscoveryAnalytics', () => {
},
);
});
it('should emit GetRECloudSubsSucceedEvent event for empty list', () => {
service.sendGetRECloudSubsSucceedEvent(
it('should emit GetRedisCloudSubsSucceedEvent event for empty list', () => {
service.sendGetRedisCloudSubsSucceedEvent(
mockSessionMetadata,
[],
CloudSubscriptionType.Flexible,
Expand All @@ -120,7 +120,7 @@ describe('CloudAutodiscoveryAnalytics', () => {

expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudSubscriptionsDiscoverySucceed,
TelemetryEvents.RedisCloudSubscriptionsDiscoverySucceed,
{
numberOfActiveSubscriptions: 0,
totalNumberOfSubscriptions: 0,
Expand All @@ -129,8 +129,8 @@ describe('CloudAutodiscoveryAnalytics', () => {
},
);
});
it('should emit GetRECloudSubsSucceedEvent event for undefined input value', () => {
service.sendGetRECloudSubsSucceedEvent(
it('should emit GetRedisCloudSubsSucceedEvent event for undefined input value', () => {
service.sendGetRedisCloudSubsSucceedEvent(
mockSessionMetadata,
undefined,
CloudSubscriptionType.Fixed,
Expand All @@ -139,7 +139,7 @@ describe('CloudAutodiscoveryAnalytics', () => {

expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudSubscriptionsDiscoverySucceed,
TelemetryEvents.RedisCloudSubscriptionsDiscoverySucceed,
{
numberOfActiveSubscriptions: 0,
totalNumberOfSubscriptions: 0,
Expand All @@ -148,11 +148,11 @@ describe('CloudAutodiscoveryAnalytics', () => {
},
);
});
it('should not throw on error when sending GetRECloudSubsSucceedEvent event', () => {
it('should not throw on error when sending GetRedisCloudSubsSucceedEvent event', () => {
const input: any = {};

expect(() =>
service.sendGetRECloudSubsSucceedEvent(
service.sendGetRedisCloudSubsSucceedEvent(
mockSessionMetadata,
input,
CloudSubscriptionType.Flexible,
Expand All @@ -163,9 +163,9 @@ describe('CloudAutodiscoveryAnalytics', () => {
});
});

describe('sendGetRECloudSubsFailedEvent', () => {
it('should emit GetRECloudSubsFailedEvent event', () => {
service.sendGetRECloudSubsFailedEvent(
describe('sendGetRedisCloudSubsFailedEvent', () => {
it('should emit GetRedisCloudSubsFailedEvent event', () => {
service.sendGetRedisCloudSubsFailedEvent(
mockSessionMetadata,
httpException,
CloudSubscriptionType.Fixed,
Expand All @@ -174,7 +174,7 @@ describe('CloudAutodiscoveryAnalytics', () => {

expect(sendFailedEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudSubscriptionsDiscoveryFailed,
TelemetryEvents.RedisCloudSubscriptionsDiscoveryFailed,
httpException,
{
type: CloudSubscriptionType.Fixed,
Expand All @@ -184,17 +184,17 @@ describe('CloudAutodiscoveryAnalytics', () => {
});
});

describe('sendGetRECloudDbsSucceedEvent', () => {
describe('sendGetRedisCloudDbsSucceedEvent', () => {
it('should emit event with active databases', () => {
service.sendGetRECloudDbsSucceedEvent(
service.sendGetRedisCloudDbsSucceedEvent(
mockSessionMetadata,
[mockCloudDatabase, mockCloudDatabaseFixed],
CloudAutodiscoveryAuthType.Credentials,
);

expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudDatabasesDiscoverySucceed,
TelemetryEvents.RedisCloudDatabasesDiscoverySucceed,
{
numberOfActiveDatabases: 2,
numberOfFreeDatabases: 1,
Expand All @@ -206,7 +206,7 @@ describe('CloudAutodiscoveryAnalytics', () => {
);
});
it('should emit event with active and not active database', () => {
service.sendGetRECloudDbsSucceedEvent(
service.sendGetRedisCloudDbsSucceedEvent(
mockSessionMetadata,
[
{
Expand All @@ -220,7 +220,7 @@ describe('CloudAutodiscoveryAnalytics', () => {

expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudDatabasesDiscoverySucceed,
TelemetryEvents.RedisCloudDatabasesDiscoverySucceed,
{
numberOfActiveDatabases: 1,
numberOfFreeDatabases: 0,
Expand All @@ -232,7 +232,7 @@ describe('CloudAutodiscoveryAnalytics', () => {
);
});
it('should emit event without active databases', () => {
service.sendGetRECloudDbsSucceedEvent(
service.sendGetRedisCloudDbsSucceedEvent(
mockSessionMetadata,
[
{
Expand All @@ -245,7 +245,7 @@ describe('CloudAutodiscoveryAnalytics', () => {

expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudDatabasesDiscoverySucceed,
TelemetryEvents.RedisCloudDatabasesDiscoverySucceed,
{
numberOfActiveDatabases: 0,
numberOfFreeDatabases: 0,
Expand All @@ -257,15 +257,15 @@ describe('CloudAutodiscoveryAnalytics', () => {
);
});
it('should emit event for empty list', () => {
service.sendGetRECloudDbsSucceedEvent(
service.sendGetRedisCloudDbsSucceedEvent(
mockSessionMetadata,
[],
CloudAutodiscoveryAuthType.Credentials,
);

expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudDatabasesDiscoverySucceed,
TelemetryEvents.RedisCloudDatabasesDiscoverySucceed,
{
numberOfActiveDatabases: 0,
numberOfFreeDatabases: 0,
Expand All @@ -277,15 +277,15 @@ describe('CloudAutodiscoveryAnalytics', () => {
);
});
it('should emit event for undefined input value', () => {
service.sendGetRECloudDbsSucceedEvent(
service.sendGetRedisCloudDbsSucceedEvent(
mockSessionMetadata,
undefined,
CloudAutodiscoveryAuthType.Credentials,
);

expect(sendEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudDatabasesDiscoverySucceed,
TelemetryEvents.RedisCloudDatabasesDiscoverySucceed,
{
numberOfActiveDatabases: 0,
numberOfFreeDatabases: 0,
Expand All @@ -300,7 +300,7 @@ describe('CloudAutodiscoveryAnalytics', () => {
const input: any = {};

expect(() =>
service.sendGetRECloudDbsSucceedEvent(
service.sendGetRedisCloudDbsSucceedEvent(
mockSessionMetadata,
input,
CloudAutodiscoveryAuthType.Credentials,
Expand All @@ -310,17 +310,17 @@ describe('CloudAutodiscoveryAnalytics', () => {
});
});

describe('sendGetRECloudDbsFailedEvent', () => {
describe('sendGetRedisCloudDbsFailedEvent', () => {
it('should emit event', () => {
service.sendGetRECloudDbsFailedEvent(
service.sendGetRedisCloudDbsFailedEvent(
mockSessionMetadata,
httpException,
CloudAutodiscoveryAuthType.Credentials,
);

expect(sendFailedEventMethod).toHaveBeenCalledWith(
mockSessionMetadata,
TelemetryEvents.RECloudDatabasesDiscoveryFailed,
TelemetryEvents.RedisCloudDatabasesDiscoveryFailed,
httpException,
{
authType: CloudAutodiscoveryAuthType.Credentials,
Expand Down
Loading
Loading