Skip to content
Merged
6 changes: 6 additions & 0 deletions redisinsight/api/config/default.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { join } from 'path';
import * as os from 'os';

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

Expand All @@ -15,6 +16,7 @@ const defaultsDir = process.env.BUILD_TYPE === 'ELECTRON' && process['resourcesP

export default {
dir_path: {
tmpDir: os.tmpdir(),
homedir,
prevHomedir: homedir,
staticDir,
Expand Down Expand Up @@ -87,10 +89,14 @@ export default {
redis_cli: {
unsupportedCommands: JSON.parse(process.env.CLI_UNSUPPORTED_COMMANDS || '[]'),
},
profiler: {
logFileIdleThreshold: parseInt(process.env.PROFILER_LOG_FILE_IDLE_THRESHOLD, 10) || 1000 * 60, // 1min
},
analytics: {
writeKey: process.env.SEGMENT_WRITE_KEY || 'SOURCE_WRITE_KEY',
},
logger: {
logLevel: process.env.LOG_LEVEL || 'info', // log level
stdout: process.env.STDOUT_LOGGER ? process.env.STDOUT_LOGGER === 'true' : false, // disabled by default
files: process.env.FILES_LOGGER ? process.env.FILES_LOGGER === 'true' : true, // enabled by default
omitSensitiveData: process.env.LOGGER_OMIT_DATA ? process.env.LOGGER_OMIT_DATA === 'true' : true,
Expand Down
1 change: 1 addition & 0 deletions redisinsight/api/config/development.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default {
migrationsRun: process.env.DB_MIGRATIONS ? process.env.DB_MIGRATIONS === 'true' : false,
},
logger: {
logLevel: process.env.LOG_LEVEL || 'debug',
stdout: process.env.STDOUT_LOGGER ? process.env.STDOUT_LOGGER === 'true' : true, // enabled by default
omitSensitiveData: process.env.LOGGER_OMIT_DATA ? process.env.LOGGER_OMIT_DATA === 'true' : false,
},
Expand Down
1 change: 1 addition & 0 deletions redisinsight/api/config/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ if (LOGGER_CONFIG.files) {
const logger: WinstonModuleOptions = {
format: format.errors({ stack: true }),
transports: transportsConfig,
level: LOGGER_CONFIG.logLevel,
};

export default logger;
13 changes: 11 additions & 2 deletions redisinsight/api/src/__mocks__/monitor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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';
import { IClientMonitorObserver } from 'src/modules/profiler/helpers/client-monitor-observer';
import { IMonitorObserver, IShardObserver, MonitorObserverStatus } from 'src/modules/profiler/helpers/monitor-observer';
import { ILogsEmitter } from 'src/modules/profiler/interfaces/logs-emitter.interface';

export const mockClientMonitorObserver: IClientMonitorObserver = {
id: uuidv4(),
Expand Down Expand Up @@ -34,3 +35,11 @@ export const mockRedisMonitorObserver: IShardObserver = {
once: jest.fn(),
disconnect: jest.fn(),
};

export const mockLogEmitter: ILogsEmitter = {
id: 'test',
emit: jest.fn(),
addProfilerClient: jest.fn(),
removeProfilerClient: jest.fn(),
flushLogs: jest.fn(),
};
4 changes: 2 additions & 2 deletions redisinsight/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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 { ProfilerModule } from './modules/profiler/profiler.module';
import { CliModule } from './modules/cli/cli.module';
import { StaticsManagementModule } from './modules/statics-management/statics-management.module';
import { SettingsController } from './controllers/settings.controller';
Expand All @@ -41,7 +41,7 @@ const PATH_CONFIG = config.get('dir_path');
WorkbenchModule,
PluginModule,
CommandsModule,
MonitorModule,
ProfilerModule,
EventEmitterModule.forRoot(),
...(SERVER_CONFIG.staticContent
? [
Expand Down
1 change: 1 addition & 0 deletions redisinsight/api/src/constants/error-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
export default {
INVALID_DATABASE_INSTANCE_ID: 'Invalid database instance id.',
COMMAND_EXECUTION_NOT_FOUND: 'Command execution was not found.',
PROFILER_LOG_FILE_NOT_FOUND: 'Profiler log file was not found.',
PLUGIN_STATE_NOT_FOUND: 'Plugin state was not found.',
UNDEFINED_INSTANCE_ID: 'Undefined redis database instance id.',
NO_CONNECTION_TO_REDIS_DB: 'No connection to the Redis Database.',
Expand Down
4 changes: 4 additions & 0 deletions redisinsight/api/src/constants/telemetry-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ export enum TelemetryEvents {
WorkbenchCommandExecuted = 'WORKBENCH_COMMAND_EXECUTED',
WorkbenchCommandErrorReceived = 'WORKBENCH_COMMAND_ERROR_RECEIVED',
WorkbenchCommandDeleted = 'WORKBENCH_COMMAND_DELETE_COMMAND',

// Profiler
ProfilerLogDownloaded = 'PROFILER_LOG_DOWNLOADED',
ProfilerLogDeleted = 'PROFILER_LOG_DELETED',
}
2 changes: 2 additions & 0 deletions redisinsight/api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default async function bootstrap() {
);
}

app.enableShutdownHooks();

await app.listen(port);
logger.log({
message: `Server is running on http(s)://localhost:${port}`,
Expand Down
8 changes: 0 additions & 8 deletions redisinsight/api/src/modules/monitor/constants/events.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading