Skip to content

Commit

Permalink
feat: Update RedisInsight to 2.46.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oblakbot committed Mar 29, 2024
1 parent 9d32dfa commit d73201f
Show file tree
Hide file tree
Showing 26 changed files with 173 additions and 30 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.44.0
2.46.0
2 changes: 1 addition & 1 deletion build/back/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exports.default = {
tlsKey: process.env.RI_SERVER_TLS_KEY,
staticContent: !!process.env.RI_SERVE_STATICS || true,
buildType: process.env.RI_BUILD_TYPE || 'DOCKER_ON_PREMISE',
appVersion: process.env.RI_APP_VERSION || '2.44.0',
appVersion: process.env.RI_APP_VERSION || '2.46.0',
requestTimeout: parseInt(process.env.RI_REQUEST_TIMEOUT, 10) || 25000,
excludeRoutes: [],
excludeAuthRoutes: [],
Expand Down
2 changes: 1 addition & 1 deletion build/back/config/features-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"cloudSsoRecommendedSettings": {
"flag": true,
"perc": [[0, 50]],
"perc": [[0, 100]],
"filters": [
{
"name": "config.server.buildType",
Expand Down
2 changes: 1 addition & 1 deletion build/back/config/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const SWAGGER_CONFIG = {
info: {
title: 'RedisInsight Backend API',
description: 'RedisInsight Backend API',
version: '2.44.0',
version: '2.46.0',
},
tags: [],
};
Expand Down
2 changes: 1 addition & 1 deletion build/back/defaults/tutorials/build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"timestamp":1709142224}
{"timestamp":1710330726}
2 changes: 1 addition & 1 deletion build/back/defaults/tutorials/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
"id": "sq",
"label": "How to query your data",
"args": {
"initialIsOpen": false
"initialIsOpen": true
},
"children": [
{
Expand Down
2 changes: 1 addition & 1 deletion build/back/defaults/tutorials/sq/range.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ FT.SEARCH idx:bicycle "@price:[(1000 +inf]"
The example below returns bicycles with a price lower than or equal to 2000 USD (`price <= 2000`) by returning the five cheapest bikes:

```redis Range query 4
FT.SEARCH idx:bicycle "@price:[-inf 2000] SORTBY price LIMIT 0 5"
FT.SEARCH idx:bicycle "@price:[-inf 2000]" SORTBY price LIMIT 0 5
```

## Non-numeric range queries
Expand Down
4 changes: 2 additions & 2 deletions build/back/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redisinsight-api",
"version": "2.44.0",
"version": "2.46.0",
"description": "RedisInsight API",
"private": true,
"author": {
Expand Down Expand Up @@ -66,7 +66,7 @@
"date-fns": "^2.29.3",
"detect-port": "^1.5.1",
"dotenv": "^16.0.0",
"express": "^4.17.1",
"express": "^4.19.2",
"fs-extra": "^10.0.0",
"ioredis": "^5.2.2",
"is-glob": "^4.0.1",
Expand Down
2 changes: 2 additions & 0 deletions build/back/src/constants/telemetry-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ var TelemetryEvents;
TelemetryEvents["CliClientDeleted"] = "CLI_CLIENT_DELETED";
TelemetryEvents["CliClientRecreated"] = "CLI_CLIENT_RECREATED";
TelemetryEvents["CliCommandExecuted"] = "CLI_COMMAND_EXECUTED";
TelemetryEvents["CliIndexInfoSubmitted"] = "CLI_INDEX_INFO_SUBMITTED";
TelemetryEvents["CliClusterNodeCommandExecuted"] = "CLI_CLUSTER_COMMAND_EXECUTED";
TelemetryEvents["CliCommandErrorReceived"] = "CLI_COMMAND_ERROR_RECEIVED";
TelemetryEvents["WorkbenchCommandExecuted"] = "WORKBENCH_COMMAND_EXECUTED";
TelemetryEvents["WorkbenchIndexInfoSubmitted"] = "WORKBENCH_INDEX_INFO_SUBMITTED";
TelemetryEvents["WorkbenchCommandErrorReceived"] = "WORKBENCH_COMMAND_ERROR_RECEIVED";
TelemetryEvents["WorkbenchCommandDeleted"] = "WORKBENCH_COMMAND_DELETE_COMMAND";
TelemetryEvents["WorkbenchEnablementAreaImportSucceeded"] = "WORKBENCH_ENABLEMENT_AREA_IMPORT_SUCCEEDED";
Expand Down
13 changes: 7 additions & 6 deletions build/back/src/modules/browser/stream/services/stream.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const constants_1 = require("../../../../constants");
const class_transformer_1 = require("class-transformer");
const database_client_factory_1 = require("../../../database/providers/database.client.factory");
const utils_2 = require("../../utils");
const utils_3 = require("../../../redis/utils");
let StreamService = StreamService_1 = class StreamService {
constructor(databaseClientFactory) {
this.databaseClientFactory = databaseClientFactory;
Expand All @@ -32,10 +33,10 @@ let StreamService = StreamService_1 = class StreamService {
const { keyName, sortOrder } = dto;
const client = await this.databaseClientFactory.getOrCreateClient(clientMetadata);
await (0, utils_2.checkIfKeyNotExists)(keyName, client);
const info = await client.sendCommand([
const info = (0, utils_3.convertArrayReplyToObject)(await client.sendCommand([
browser_tool_commands_1.BrowserToolStreamCommands.XInfoStream,
keyName,
]);
]));
let entries = [];
if (sortOrder && sortOrder === sort_1.SortOrder.Asc) {
entries = await this.getRange(client, dto);
Expand All @@ -46,10 +47,10 @@ let StreamService = StreamService_1 = class StreamService {
this.logger.log('Succeed to get entries from the stream.');
return (0, class_transformer_1.plainToClass)(dto_1.GetStreamEntriesResponse, {
keyName,
total: info[1],
lastGeneratedId: info[7].toString(),
firstEntry: StreamService_1.formatArrayToDto(info[11]),
lastEntry: StreamService_1.formatArrayToDto(info[13]),
total: info['length'],
lastGeneratedId: info['last-generated-id'].toString(),
firstEntry: StreamService_1.formatArrayToDto(info['first-entry']),
lastEntry: StreamService_1.formatArrayToDto(info['last-entry']),
entries,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ let CliAnalyticsService = class CliAnalyticsService extends command_telemetry_ba
catch (e) {
}
}
sendIndexInfoEvent(databaseId, additionalData) {
if (!additionalData) {
return;
}
try {
this.sendEvent(constants_1.TelemetryEvents.CliIndexInfoSubmitted, {
databaseId,
...additionalData,
});
}
catch (e) {
}
}
async sendCommandExecutedEvent(databaseId, additionalData = {}) {
try {
this.sendEvent(constants_1.TelemetryEvents.CliCommandExecuted, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const client_not_found_error_exception_1 = require("../../../redis/exceptions/cl
const database_recommendation_service_1 = require("../../../database-recommendation/database-recommendation.service");
const database_client_factory_1 = require("../../../database/providers/database.client.factory");
const uuid_1 = require("uuid");
const utils_1 = require("../../../../utils");
const output_formatter_manager_1 = require("./output-formatter/output-formatter-manager");
const output_formatter_interface_1 = require("./output-formatter/output-formatter.interface");
const text_formatter_strategy_1 = require("./output-formatter/strategies/text-formatter.strategy");
Expand Down Expand Up @@ -109,6 +110,9 @@ let CliBusinessService = class CliBusinessService {
command,
outputFormat,
});
if (command.toLowerCase() === 'ft.info') {
this.cliAnalyticsService.sendIndexInfoEvent(clientMetadata.databaseId, (0, utils_1.getAnalyticsDataFromIndexInfo)(reply));
}
this.logger.log('Succeed to execute redis CLI command.');
return {
response: formatter.format(reply),
Expand Down
7 changes: 5 additions & 2 deletions build/back/src/modules/redis/utils/reply.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseNodesFromClusterInfoReply = exports.convertMultilineReplyToObject = exports.convertArrayReplyToObject = void 0;
const lodash_1 = require("lodash");
const convertArrayReplyToObject = (input) => (0, lodash_1.chunk)(input, 2).reduce((prev, current) => {
const convertArrayReplyToObject = (input, options = {}) => (0, lodash_1.chunk)(input, 2).reduce((prev, current) => {
const [key, value] = current;
return { ...prev, [key.toLowerCase()]: value };
return {
...prev,
[key.toString().toLowerCase()]: options.utf && !(0, lodash_1.isArray)(value) ? value === null || value === void 0 ? void 0 : value.toString() : value,
};
}, {});
exports.convertArrayReplyToObject = convertArrayReplyToObject;
const convertMultilineReplyToObject = (info, lineSeparator = '\r\n', valueSeparator = ':') => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const errors_1 = require("../../cli/constants/errors");
const constants_1 = require("../../../constants");
const create_command_execution_dto_1 = require("../dto/create-command-execution.dto");
const transformers_1 = require("../../../common/transformers");
const utils_1 = require("../../../utils");
const workbench_analytics_service_1 = require("../services/workbench-analytics/workbench-analytics.service");
let WorkbenchCommandsExecutor = class WorkbenchCommandsExecutor {
constructor(analyticsService) {
Expand All @@ -39,6 +40,9 @@ let WorkbenchCommandsExecutor = class WorkbenchCommandsExecutor {
const result = [{ response, status: cli_dto_1.CommandExecutionStatus.Success }];
this.logger.log('Succeed to execute workbench command.');
this.analyticsService.sendCommandExecutedEvents(client.clientMetadata.databaseId, result, { command, rawMode: mode === create_command_execution_dto_1.RunQueryMode.Raw });
if (command.toLowerCase() === 'ft.info') {
this.analyticsService.sendIndexInfoEvent(client.clientMetadata.databaseId, (0, utils_1.getAnalyticsDataFromIndexInfo)(response));
}
return result;
}
catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ let WorkbenchAnalyticsService = class WorkbenchAnalyticsService extends command_
this.eventEmitter = eventEmitter;
this.commandsService = commandsService;
}
sendIndexInfoEvent(databaseId, additionalData) {
if (!additionalData) {
return;
}
try {
this.sendEvent(constants_1.TelemetryEvents.WorkbenchIndexInfoSubmitted, {
databaseId,
...additionalData,
});
}
catch (e) {
}
}
async sendCommandExecutedEvents(databaseId, results, additionalData = {}) {
try {
await Promise.all(results.map((result) => this.sendCommandExecutedEvent(databaseId, result, additionalData)));
Expand Down
41 changes: 40 additions & 1 deletion build/back/src/utils/analytics-helper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIsPipelineEnable = exports.calculateRedisHitRatio = exports.getRangeForNumber = exports.BULK_ACTIONS_BREAKPOINTS = exports.SCAN_THRESHOLD_BREAKPOINTS = exports.TOTAL_KEYS_BREAKPOINTS = void 0;
exports.getAnalyticsDataFromIndexInfo = exports.getIsPipelineEnable = exports.calculateRedisHitRatio = exports.getRangeForNumber = exports.BULK_ACTIONS_BREAKPOINTS = exports.SCAN_THRESHOLD_BREAKPOINTS = exports.TOTAL_KEYS_BREAKPOINTS = void 0;
const lodash_1 = require("lodash");
const reply_util_1 = require("../modules/redis/utils/reply.util");
exports.TOTAL_KEYS_BREAKPOINTS = [
500000,
1000000,
Expand Down Expand Up @@ -60,3 +61,41 @@ const calculateRedisHitRatio = (keyspaceHits, keyspaceMisses) => {
exports.calculateRedisHitRatio = calculateRedisHitRatio;
const getIsPipelineEnable = (size) => size > 1;
exports.getIsPipelineEnable = getIsPipelineEnable;
const getAnalyticsDataFromIndexInfo = (reply) => {
const analyticsData = {};
try {
const replyInfo = (0, reply_util_1.convertArrayReplyToObject)(reply, { utf: true });
const definition = (0, reply_util_1.convertArrayReplyToObject)(replyInfo.index_definition, { utf: true });
analyticsData['key_type'] = definition === null || definition === void 0 ? void 0 : definition.key_type;
analyticsData['default_score'] = definition === null || definition === void 0 ? void 0 : definition.default_score;
analyticsData['num_docs'] = replyInfo === null || replyInfo === void 0 ? void 0 : replyInfo.num_docs;
analyticsData['max_doc_id'] = replyInfo === null || replyInfo === void 0 ? void 0 : replyInfo.max_doc_id;
analyticsData['num_terms'] = replyInfo === null || replyInfo === void 0 ? void 0 : replyInfo.num_terms;
analyticsData['num_records'] = replyInfo === null || replyInfo === void 0 ? void 0 : replyInfo.num_records;
analyticsData['total_indexing_time'] = replyInfo === null || replyInfo === void 0 ? void 0 : replyInfo.total_indexing_time;
analyticsData['number_of_uses'] = replyInfo === null || replyInfo === void 0 ? void 0 : replyInfo.number_of_uses;
analyticsData['cleaning'] = replyInfo === null || replyInfo === void 0 ? void 0 : replyInfo.cleaning;
if (replyInfo.dialect_stats) {
analyticsData['dialect_stats'] = (0, reply_util_1.convertArrayReplyToObject)(replyInfo.dialect_stats, { utf: true });
}
analyticsData['attributes'] = (0, lodash_1.map)(replyInfo === null || replyInfo === void 0 ? void 0 : replyInfo.attributes, ((attr) => {
const attrArray = (0, lodash_1.map)(attr, (str) => str.toString().toLowerCase());
const attrObject = (0, reply_util_1.convertArrayReplyToObject)(attr, { utf: true });
return {
type: attrObject === null || attrObject === void 0 ? void 0 : attrObject['type'],
weight: (attrObject === null || attrObject === void 0 ? void 0 : attrObject['weight']) || undefined,
phonetic: (attrObject === null || attrObject === void 0 ? void 0 : attrObject['phonetic']) || undefined,
sortable: (0, lodash_1.includes)(attrArray, 'sortable') || undefined,
nostem: (0, lodash_1.includes)(attrArray, 'nostem') || undefined,
unf: (0, lodash_1.includes)(attrArray, 'unf') || undefined,
noindex: (0, lodash_1.includes)(attrArray, 'noindex') || undefined,
casesensitive: (0, lodash_1.includes)(attrArray, 'casesensitive') || undefined,
};
}));
return analyticsData;
}
catch (e) {
return null;
}
};
exports.getAnalyticsDataFromIndexInfo = getAnalyticsDataFromIndexInfo;
28 changes: 25 additions & 3 deletions build/back/src/utils/logsFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.prettyFormat = exports.jsonFormat = exports.sensitiveDataFormatter = void 0;
const winston_1 = require("winston");
const lodash_1 = require("lodash");
const util_1 = require("util");
const errorWhiteListFields = [
'message',
'command.name',
];
const sanitizeStack = (stack) => {
try {
let sanitizedStack = stack;
if (stack && stack.length) {
sanitizedStack = stack.map((error) => {
var _a;
if ((error === null || error === void 0 ? void 0 : error.name) === 'AxiosError') {
return {
...(0, lodash_1.pick)(error, ['message', 'name', 'code', 'stack']),
response: (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data,
};
}
return error;
});
}
return (0, util_1.inspect)(sanitizedStack);
}
catch (e) {
return e.stack;
}
};
exports.sensitiveDataFormatter = (0, winston_1.format)((info, opts = {}) => {
let stack;
if (opts === null || opts === void 0 ? void 0 : opts.omitSensitiveData) {
Expand All @@ -25,7 +47,7 @@ exports.sensitiveDataFormatter = (0, winston_1.format)((info, opts = {}) => {
}
return {
...info,
stack,
stack: sanitizeStack(stack),
};
});
exports.jsonFormat = winston_1.format.printf((info) => {
Expand All @@ -34,14 +56,14 @@ exports.jsonFormat = winston_1.format.printf((info) => {
timestamp: new Date().toLocaleString(),
context: info.context,
message: info.message,
stack: info.stack,
stack: sanitizeStack(info.stack),
};
return JSON.stringify(logData);
});
exports.prettyFormat = winston_1.format.printf((info) => {
const separator = ' | ';
const timestamp = new Date().toLocaleString();
const { level, context, message, stack, } = info;
const logData = [timestamp, `${level}`.toUpperCase(), context, message, JSON.stringify({ stack })];
const logData = [timestamp, `${level}`.toUpperCase(), context, message, { stack: sanitizeStack(stack) }];
return logData.join(separator);
});
2 changes: 1 addition & 1 deletion build/back/static/plugins/clients-list/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/back/tsconfig.build.prod.tsbuildinfo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/front/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en" dir="ltr"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><title>RedisInsight</title><base href="/"/><script defer="defer" src="/js/bundle.runtime.min.js"></script><script defer="defer" src="/js/bundle.elasticVendor.min.js"></script><script defer="defer" src="/js/bundle.monacoVendor.min.js"></script><script defer="defer" src="/js/bundle.utilityVendor.min.js"></script><script defer="defer" src="/js/bundle.reactVendor.min.js"></script><script defer="defer" src="/js/bundle.483.min.js"></script><script defer="defer" src="/js/bundle.main.min.js"></script><link href="/main.910fe660580bfa728b29.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
<!doctype html><html lang="en" dir="ltr"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><title>RedisInsight</title><base href="/"/><script defer="defer" src="/js/bundle.runtime.min.js"></script><script defer="defer" src="/js/bundle.elasticVendor.min.js"></script><script defer="defer" src="/js/bundle.monacoVendor.min.js"></script><script defer="defer" src="/js/bundle.utilityVendor.min.js"></script><script defer="defer" src="/js/bundle.reactVendor.min.js"></script><script defer="defer" src="/js/bundle.483.min.js"></script><script defer="defer" src="/js/bundle.main.min.js"></script><link href="/main.4e635793eb2e86c2e55c.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
2 changes: 1 addition & 1 deletion build/front/js/bundle.elasticVendor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/front/js/bundle.main.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/front/main.4e635793eb2e86c2e55c.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion build/front/main.910fe660580bfa728b29.css

This file was deleted.

4 changes: 2 additions & 2 deletions build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redisinsight-api",
"version": "2.44.0",
"version": "2.46.0",
"description": "RedisInsight API",
"private": true,
"author": {
Expand Down Expand Up @@ -66,7 +66,7 @@
"date-fns": "^2.29.3",
"detect-port": "^1.5.1",
"dotenv": "^16.0.0",
"express": "^4.17.1",
"express": "^4.19.2",
"fs-extra": "^10.0.0",
"ioredis": "^5.2.2",
"is-glob": "^4.0.1",
Expand Down
Loading

0 comments on commit d73201f

Please sign in to comment.