Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
7decd97
#RI-2180 - add monitor gateway
Dec 17, 2021
5f87d27
Merge branch 'main' into feature/RI-2180_monitor
Dec 17, 2021
c48be89
* #RI-2180 - refactor monitor functionality
Dec 23, 2021
92d780e
#RI-2180 - fix packages
Dec 23, 2021
6b9ac0d
Merge branch 'main' into feature/RI-1227_monitor
egor-zalenski Dec 24, 2021
4fecd72
#RI-1227 - Fix build for electron (Monitor)
egor-zalenski Dec 24, 2021
06fdff1
Merge branch 'main' into feature/RI-1227_monitor
egor-zalenski Jan 5, 2022
6f0050a
* #RI-1227 - Monitor UI
egor-zalenski Jan 6, 2022
d50f097
Merge branch 'main' into feature/RI-1227_monitor
egor-zalenski Jan 6, 2022
5d33c40
#RI-1227 - skip time tests
egor-zalenski Jan 6, 2022
fa42cf2
Update Monitor.tsx
egor-zalenski Jan 6, 2022
a1636d5
enable monitor socket cors for dev env
Jan 6, 2022
bf46d89
* #RI-1227 - fix pr comments
egor-zalenski Jan 6, 2022
ce024ef
Merge branch 'main' into feature/RI-1227_monitor
Jan 12, 2022
7ed27f3
Improve monitor logs to not stuck when big amount of data receved
Jan 13, 2022
6f8f6f5
Merge branch 'main' into feature/RI-1227_monitor
Jan 13, 2022
b30c3ed
#RI-2311 - do not display monitor in the list of unsupported commands
Jan 13, 2022
fac5f08
Merge pull request #196 from RedisInsight/fix/RI-2311_monitor-command…
ArtyomPSofteq Jan 14, 2022
ff9cb19
#RI-2332 - add virtualized list to monitor output
Jan 17, 2022
62355eb
#RI-2332 - add CellMeasurer to recalculate height
Jan 18, 2022
5c303cc
revert back ServerStaticModule
Jan 19, 2022
64a39ad
[E2E] Monitor tests are added
elenaNaboko Jan 20, 2022
d5859fa
[E2E] Fix monitor tests
elenaNaboko Jan 20, 2022
eebf68c
[E2E] Add Stop Monitor test
elenaNaboko Jan 20, 2022
34160e8
Merge branch 'main' into feature/RI-1227_monitor
egor-zalenski Jan 21, 2022
98fe67a
merge main branch to current
egor-zalenski Jan 21, 2022
8e211bb
[E2E] Clear and stop monitor tests are added
elenaNaboko Jan 21, 2022
ad9db13
[E2E] HTTP/HTTPS error fix for Monitor
elenaNaboko Jan 24, 2022
598a718
[E2E] Run Monitor tests only
elenaNaboko Jan 24, 2022
09d106c
Merge branch 'main' into feature/RI-2332_monitor-performance
egor-zalenski Jan 25, 2022
2ea4064
Merge remote-tracking branch 'origin/feature/RI-1227_monitor' into fe…
egor-zalenski Jan 25, 2022
4b44ac4
#RI-1227 - handle 'disconnect' event for socket client
Jan 25, 2022
d3abe96
Merge pull request #229 from RedisInsight/main
egor-zalenski Jan 25, 2022
28c5b1f
revert back commit #RI-1227 - handle 'disconnect' event for socket cl…
Jan 25, 2022
6fe2094
Merge branch 'main' into feature/RI-1227_monitor
elenaNaboko Jan 25, 2022
e9deb65
Merge branch 'feature/RI-1227_monitor' into feature/e2e-monitor
elenaNaboko Jan 25, 2022
db1f1fb
Merge branch 'feature/RI-1227_monitor' of github.com:RedisInsight/Red…
Jan 25, 2022
11c4bf5
#RI-2166 - handle client disconnect
Jan 25, 2022
059131a
Merge branch 'feature/RI-1227_monitor' into feature/RI-2332_monitor-p…
egor-zalenski Jan 26, 2022
6827966
#RI-2296 - Monitor crushes when working with big data
egor-zalenski Jan 26, 2022
d2d4cd6
Merge branch 'main' into feature/RI-1227_monitor
egor-zalenski Jan 26, 2022
5c8d76f
fix ui unit test
egor-zalenski Jan 26, 2022
11fe5cc
Merge branch 'feature/RI-1227_monitor' into feature/e2e-monitor
elenaNaboko Jan 26, 2022
4a8ceb5
Merge pull request #234 from RedisInsight/feature/RI-2332_monitor-per…
egor-zalenski Jan 27, 2022
5b1f9b0
Merge pull request #231 from RedisInsight/fix/RI-2166_handle-client-d…
ArtyomPSofteq Jan 27, 2022
8b42543
Merge branch 'main' into feature/RI-1227_monitor
egor-zalenski Jan 27, 2022
73f5369
#RI-2332 handle socket reconnect
Jan 27, 2022
0e15a1d
fix unit tests
Jan 27, 2022
218255b
Merge pull request #238 from RedisInsight/fix/RI-2332_socket-reconnect
ArtyomPSofteq Jan 27, 2022
d4bf56a
add debounce to send messages in batches since send ws message is cpu…
Jan 28, 2022
65d5b29
Merge pull request #239 from RedisInsight/bugfix/add_debounce_on_be_s…
Jan 28, 2022
0526e1a
#RI-2356 - specify a human-readable error message
Jan 28, 2022
c38664c
fix urls for various builds
Jan 28, 2022
103ee6a
Merge branch 'bugfix/fix_base_urls_for_various_builds' into feature/e…
Jan 28, 2022
dd478d7
fix pr comments
Jan 28, 2022
8367991
Merge pull request #241 from RedisInsight/fix/RI-1227_failed-connecti…
ArtyomPSofteq Jan 28, 2022
56f1d25
Merge pull request #242 from RedisInsight/bugfix/fix_base_urls_for_va…
Jan 28, 2022
2df7f64
Merge branch 'feature/e2e-monitor' of https://github.com/RedisInsight…
elenaNaboko Jan 31, 2022
64a4249
#RI-2362 - rename Monitor to Profiler
Jan 31, 2022
c816143
Merge pull request #245 from RedisInsight/feature/RI-2362-rename-monitor
rsergeenko Jan 31, 2022
e6fe95f
Merge branch 'feature/RI-1227_monitor' into feature/e2e-monitor
elenaNaboko Jan 31, 2022
3e81acb
[E2E] Monitor test with high DB load
elenaNaboko Feb 1, 2022
027a309
[E2E] Rename Monitor into Profiler in tests
elenaNaboko Feb 1, 2022
c0b9834
#RI-2392, RI-2393, RI-2394 - fix monitor output issues
Feb 1, 2022
e871621
[E2E] New oss big standalone is added
elenaNaboko Feb 1, 2022
a957aa7
Merge pull request #248 from RedisInsight/bugfix/RI-2392-RI-2393-RI-2394
rsergeenko Feb 1, 2022
4504a83
Merge pull request #213 from RedisInsight/feature/e2e-monitor
elenaNaboko Feb 1, 2022
3a8532f
#RI-2408 - capitalize profiler
Feb 1, 2022
389901f
Merge pull request #249 from RedisInsight/bugfix/RI-2408
rsergeenko Feb 1, 2022
e16eee8
[E2E] Remove only mark for Monitor tests
elenaNaboko Feb 2, 2022
99cbd6a
added color for args in the Monitor
egor-zalenski Feb 2, 2022
3ff4193
Merge remote-tracking branch 'origin/feature/RI-1227_monitor' into fe…
egor-zalenski Feb 2, 2022
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
4 changes: 2 additions & 2 deletions configs/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ export default {
// 'swagger-ui-express',
// 'class-transformer',
// 'class-transformer/storage',
'@nestjs/websockets',
// '@nestjs/websockets',
// '@nestjs/core/adapters/http-adapter',
// '@nestjs/core/helpers/router-method-factory',
// '@nestjs/core/metadata-scanner',
'@nestjs/microservices/microservices-module',
'@nestjs/websockets/socket-module',
// '@nestjs/websockets/socket-module',
];
if (!lazyImports.includes(resource)) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions configs/webpack.config.web.common.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ export default {
'reflect-metadata',
'swagger-ui-express',
'class-transformer/storage',
'@nestjs/websockets',
// '@nestjs/websockets',
'@nestjs/microservices/microservices-module',
'@nestjs/websockets/socket-module',
// '@nestjs/websockets/socket-module',
];
if (!lazyImports.includes(resource)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"gatekeeperAssess": false
},
"dmg": {
"artifactName": "${productName}-${os}-x64.${ext}",
"artifactName": "${productName}-${os}-${arch}.${ext}",
"contents": [
{
"x": 130,
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.1.0",
"skip-postinstall": "^1.0.0",
"socket.io-mock": "^1.3.2",
"source-map-support": "^0.5.19",
"style-loader": "^2.0.0",
"supertest": "^4.0.2",
Expand Down Expand Up @@ -255,6 +256,7 @@
"remark-gfm": "^3.0.1",
"remark-parse": "^10.0.1",
"remark-rehype": "^10.0.1",
"socket.io-client": "^4.4.0",
"unified": "^10.1.1",
"unist-util-visit": "^4.1.0"
},
Expand Down
4 changes: 4 additions & 0 deletions redisinsight/api/config/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export default {
appVersion: process.env.APP_VERSION || '2.0.0',
requestTimeout: parseInt(process.env.REQUEST_TIMEOUT, 10) || 10000,
},
sockets: {
cors: process.env.SOCKETS_CORS ? process.env.SOCKETS_CORS === 'true' : false,
serveClient: process.env.SOCKETS_SERVE_CLIENT ? process.env.SOCKETS_SERVE_CLIENT === 'true' : false,
},
db: {
database: join(homedir, 'redisinsight.db'),
synchronize: process.env.DB_SYNC ? process.env.DB_SYNC === 'true' : false,
Expand Down
3 changes: 3 additions & 0 deletions redisinsight/api/config/development.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ export default {
server: {
tls: process.env.SERVER_TLS ? process.env.SERVER_TLS === 'true' : false,
},
sockets: {
cors: true,
},
db: {
synchronize: process.env.DB_SYNC ? process.env.DB_SYNC === 'true' : true,
migrationsRun: process.env.DB_MIGRATIONS ? process.env.DB_MIGRATIONS === 'true' : false,
Expand Down
16 changes: 2 additions & 14 deletions redisinsight/api/config/test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
import { join } from 'path';

const homedir = join(__dirname, '..');

module.exports = {
dir_path: {
homedir,
logs: join(homedir, 'logs'),
caCertificates: join(homedir, 'ca_certificates'),
clientCertificates: join(homedir, 'client_certificates'),
},
export default {
server: {
env: 'test',
tls: !!process.env.SERVER_TLS || true,
tlsCert: process.env.SERVER_TLS_CERT,
tlsKey: process.env.SERVER_TLS_KEY,
requestTimeout: 1000,
},
};
11 changes: 8 additions & 3 deletions redisinsight/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"start:debug": "nest start --debug --watch",
"start:stage": "cross-env NODE_ENV=staging SERVER_STATIC_CONTENT=true node dist/src/main",
"start:prod": "cross-env NODE_ENV=production node dist/src/main",
"test": "./node_modules/.bin/jest -w 1",
"test:watch": "jest --watch -w 1",
"test:cov": "./node_modules/.bin/jest --coverage -w 1",
"test": "cross-env NODE_ENV=test ./node_modules/.bin/jest -w 1",
"test:watch": "cross-env NODE_ENV=test jest --watch -w 1",
"test:cov": "cross-env NODE_ENV=test ./node_modules/.bin/jest --coverage -w 1",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand -w 1",
"test:e2e": "jest --config ./test/jest-e2e.json -w 1",
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ./config/ormconfig.ts",
Expand All @@ -40,9 +40,11 @@
"@nestjs/core": "^7.0.0",
"@nestjs/event-emitter": "^1.0.0",
"@nestjs/platform-express": "^7.0.0",
"@nestjs/platform-socket.io": "^8.2.3",
"@nestjs/serve-static": "^2.1.3",
"@nestjs/swagger": "^4.6.1",
"@nestjs/typeorm": "^7.1.5",
"@nestjs/websockets": "^8.2.3",
"adm-zip": "^0.5.9",
"analytics-node": "^4.0.1",
"axios": "^0.21.0",
Expand All @@ -60,6 +62,7 @@
"nest-winston": "^1.4.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^6.6.7",
"socket.io": "^4.4.0",
"source-map-support": "^0.5.19",
"sqlite3": "^5.0.2",
"swagger-ui-express": "^4.1.4",
Expand All @@ -79,6 +82,7 @@
"@types/jest": "^26.0.15",
"@types/lodash": "^4.14.167",
"@types/node": "14.14.10",
"@types/socket.io": "^3.0.2",
"@types/supertest": "^2.0.8",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
Expand All @@ -101,6 +105,7 @@
"nyc": "^15.1.0",
"object-diff": "^0.0.4",
"rimraf": "^3.0.2",
"socket.io-mock": "^1.3.2",
"supertest": "^4.0.2",
"ts-jest": "^26.1.0",
"ts-loader": "^6.2.1",
Expand Down
36 changes: 36 additions & 0 deletions redisinsight/api/src/__mocks__/monitor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { v4 as uuidv4 } from 'uuid';
import { IClientMonitorObserver } from 'src/modules/monitor/helpers/client-monitor-observer';
import { IMonitorObserver, IShardObserver, MonitorObserverStatus } from 'src/modules/monitor/helpers/monitor-observer';

export const mockClientMonitorObserver: IClientMonitorObserver = {
id: uuidv4(),
handleOnData: jest.fn(),
handleOnDisconnect: jest.fn(),
};

export const mockMonitorObserver: IMonitorObserver = {
status: MonitorObserverStatus.Wait,
subscribe: jest.fn(),
unsubscribe: jest.fn(),
getSize: jest.fn(),
clear: jest.fn(),
};

export const mockRedisMonitorObserver: IShardObserver = {
addListener: jest.fn(),
eventNames: jest.fn(),
getMaxListeners: jest.fn(),
listenerCount: jest.fn(),
listeners: jest.fn(),
prependListener: jest.fn(),
prependOnceListener: jest.fn(),
removeAllListeners: jest.fn(),
removeListener: jest.fn(),
rawListeners: jest.fn(),
setMaxListeners: jest.fn(),
on: jest.fn(),
emit: jest.fn(),
off: jest.fn(),
once: jest.fn(),
disconnect: jest.fn(),
};
2 changes: 2 additions & 0 deletions redisinsight/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { InstancesModule } from './modules/instances/instances.module';
import { BrowserModule } from './modules/browser/browser.module';
import { RedisEnterpriseModule } from './modules/redis-enterprise/redis-enterprise.module';
import { RedisSentinelModule } from './modules/redis-sentinel/redis-sentinel.module';
import { MonitorModule } from './modules/monitor/monitor.module';
import { CliModule } from './modules/cli/cli.module';
import { SettingsController } from './controllers/settings.controller';
import { ServerInfoController } from './controllers/server-info.controller';
Expand All @@ -37,6 +38,7 @@ const PATH_CONFIG = config.get('dir_path');
WorkbenchModule,
PluginModule,
CommandsModule,
MonitorModule,
EventEmitterModule.forRoot(),
...(SERVER_CONFIG.staticContent
? [
Expand Down
4 changes: 4 additions & 0 deletions redisinsight/api/src/constants/app-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ export enum AppAnalyticsEvents {
Initialize = 'analytics.initialize',
Track = 'analytics.track',
}

export enum AppRedisInstanceEvents {
Deleted = 'instance.deleted',
}
2 changes: 1 addition & 1 deletion redisinsight/api/src/modules/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { DynamicModule, Global, Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CaCertificateEntity } from 'src/modules/core/models/ca-certificate.entity';
import { ClientCertificateEntity } from 'src/modules/core/models/client-certificate.entity';
import { PlainEncryptionStrategy } from 'src/modules/core/encryption/strategies/plain-encryption.strategy';
import { AgreementsRepository } from './repositories/agreements.repository';
import { ServerRepository } from './repositories/server.repository';
import { SettingsRepository } from './repositories/settings.repository';
import settingsOnPremiseFactory from './providers/settings-on-premise';
import serverOnPremiseFactory from './providers/server-on-premise';
import { EncryptionService } from 'src/modules/core/encryption/encryption.service';
import { KeytarEncryptionStrategy } from 'src/modules/core/encryption/strategies/keytar-encryption.strategy';
import { PlainEncryptionStrategy } from 'src/modules/core/encryption/strategies/plain-encryption.strategy';
import { CaCertBusinessService } from './services/certificates/ca-cert-business/ca-cert-business.service';
import { ClientCertBusinessService } from './services/certificates/client-cert-business/client-cert-business.service';
import { RedisService } from './services/redis/redis.service';
Expand Down
8 changes: 8 additions & 0 deletions redisinsight/api/src/modules/monitor/constants/events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export enum MonitorGatewayClientEvents {
Monitor = 'monitor',
}

export enum MonitorGatewayServerEvents {
Data = 'monitorData',
Exception = 'exception',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import IORedis from 'ioredis';

export interface IOnDatePayload {
time: string;
args: string[];
source: string;
database: number;
shardOptions: IORedis.RedisOptions
}

export interface IClientMonitorObserver {
id: string;
handleOnData: (data: IOnDatePayload) => void;
handleOnDisconnect: () => void;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { WsException } from '@nestjs/websockets';
import * as MockedSocket from 'socket.io-mock';
import ERROR_MESSAGES from 'src/constants/error-messages';
import { MonitorGatewayServerEvents } from 'src/modules/monitor/constants/events';
import ClientMonitorObserver from './client-monitor-observer';
import { IOnDatePayload } from './client-monitor-observer.interface';

describe('ClientMonitorObserver', () => {
let socketClient;

beforeEach(() => {
socketClient = new MockedSocket();
socketClient.id = '123';
socketClient.emit = jest.fn();
});

it.only('should be defined', () => {
const client = new ClientMonitorObserver(socketClient.id, socketClient);

expect(client.id).toEqual(socketClient.id);
});
it.only('should emit event on monitorData', async () => {
const client = new ClientMonitorObserver(socketClient.id, socketClient);
const monitorData = {
// unix timestamp
time: `${(new Date()).getTime() / 1000}`,
source: '127.0.0.1:58612',
database: 0,
args: ['set', 'foo', 'bar'],
};
const payload: IOnDatePayload = { ...monitorData, shardOptions: { host: '127.0.0.1', port: 6379 } };

client.handleOnData(payload);

await new Promise((r) => setTimeout(r, 500));

expect(socketClient.emit).toHaveBeenCalledWith(MonitorGatewayServerEvents.Data, [monitorData]);
});
it.only('should emit exception event', () => {
const client = new ClientMonitorObserver(socketClient.id, socketClient);

client.handleOnDisconnect();

expect(socketClient.emit).toHaveBeenCalledWith(
MonitorGatewayServerEvents.Exception,
new WsException(ERROR_MESSAGES.NO_CONNECTION_TO_REDIS_DB),
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Socket } from 'socket.io';
import { MonitorGatewayServerEvents } from 'src/modules/monitor/constants/events';
import { WsException } from '@nestjs/websockets';
import ERROR_MESSAGES from 'src/constants/error-messages';
import { debounce } from 'lodash';
import { IClientMonitorObserver, IOnDatePayload } from './client-monitor-observer.interface';

class ClientMonitorObserver implements IClientMonitorObserver {
public readonly id: string;

private readonly client: Socket;

private filters: any[];

private readonly debounce: any;

private items: any[];

constructor(id: string, client: Socket) {
this.id = id;
this.client = client;
this.items = [];
this.debounce = debounce(() => {
if (this.items.length) {
this.client.emit(MonitorGatewayServerEvents.Data, this.items);
this.items = [];
}
}, 10, {
maxWait: 50,
});
}

public handleOnData(payload: IOnDatePayload) {
const {
time, args, source, database,
} = payload;

this.items.push({
time, args, source, database,
});

this.debounce();
}

public handleOnDisconnect() {
this.client.emit(
MonitorGatewayServerEvents.Exception,
new WsException(ERROR_MESSAGES.NO_CONNECTION_TO_REDIS_DB),
);
}
}
export default ClientMonitorObserver;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './client-monitor-observer'
export * from './client-monitor-observer.interface'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './monitor-observer.interface';
export * from './monitor-observer';
export * from './shard-obsever.interface';
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { IClientMonitorObserver } from '../client-monitor-observer';

export enum MonitorObserverStatus {
Wait = 'wait',
Ready = 'ready',
End = 'end',
Error = 'error',
}

export interface IMonitorObserver {
status: MonitorObserverStatus;
subscribe: (client: IClientMonitorObserver) => Promise<void>;
unsubscribe: (id: string) => void;
getSize: () => number;
clear: () => void;
}
Loading