Skip to content

Commit

Permalink
Merge pull request #106 from epoberezhny/feature/fix-redis-info
Browse files Browse the repository at this point in the history
Fixed redis stats block
  • Loading branch information
vcapretz authored May 27, 2020
2 parents b32913d + f8c2e85 commit 33de4b4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 5 additions & 4 deletions routes/getDataForQeues.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { pick, isEmpty } = require('ramda')
const { parse: parseRedisInfo } = require('redis-info')

const metrics = [
'redis_version',
Expand All @@ -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
}
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 33de4b4

Please sign in to comment.