diff --git a/package.json b/package.json index 51991461..725fe88f 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "ramda": "^0.26.1", "react": "16.10.2", "react-dom": "16.10.2", - "react-highlight": "^0.12.0" + "react-highlight": "^0.12.0", + "redis-info": "^3.0.8" }, "devDependencies": { "babel-preset-react-app": "^7.0.2", diff --git a/routes/getDataForQeues.js b/routes/getDataForQeues.js index 84620389..c1024e92 100644 --- a/routes/getDataForQeues.js +++ b/routes/getDataForQeues.js @@ -1,4 +1,5 @@ const { pick, isEmpty } = require('ramda') +const { parse: parseRedisInfo } = require('redis-info') const metrics = [ 'redis_version', @@ -9,12 +10,12 @@ const metrics = [ ] async function getStats(queue) { - await queue.client.info() + const rawRedisInfo = await queue.client.info() + const redisInfo = parseRedisInfo(rawRedisInfo) - const validMetrics = pick(metrics, queue.client.serverInfo) + const validMetrics = pick(metrics, redisInfo) validMetrics.total_system_memory = - queue.client.serverInfo.total_system_memory || - queue.client.serverInfo.maxmemory + redisInfo.total_system_memory || redisInfo.maxmemory return validMetrics } diff --git a/yarn.lock b/yarn.lock index 9fa04f01..e8857157 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6008,6 +6008,13 @@ redis-errors@^1.0.0, redis-errors@^1.2.0: resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad" integrity sha1-62LSrbFeTq9GEMBK/hUpOEJQq60= +redis-info@^3.0.8: + version "3.0.8" + resolved "https://registry.yarnpkg.com/redis-info/-/redis-info-3.0.8.tgz#27e696778c100d716324fa68b92cccf390487e02" + integrity sha512-L7yPuGzRq+gu+ZYl/aO0TDgc4nNcMpDTaTN4P3bBi8ZENp1fk8gvtZQpidrYL5uAJYMIcMN81fgUz28qUpTeVA== + dependencies: + lodash "^4.17.11" + redis-parser@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-3.0.0.tgz#b66d828cdcafe6b4b8a428a7def4c6bcac31c8b4"