I am using a golang queue library and it has an inbuilt monitoring UI which just spews errors.
https://github.com/hibiken/asynqmon/issues/210
Via this issue I tried the getMemoryLua script and it does indeed show the following error:
(error) ERR Error running script (call to d1d11371f87d10f5e0fff48dae6916d007a66f3e): @user_script:19: This Redis command is not allowed from script
local sample_size = tonumber(20)
if sample_size <= 0 then
return redis.error_reply("sample size must be a positive number")
end
local memusg = 0
for i=1,2 do
local ids = redis.call("LRANGE", "asynq:default:active", 0, sample_size - 1)
local sample_total = 0
if (table.getn(ids) > 0) then
for _, id in ipairs(ids) do
local bytes = redis.call("MEMORY", "USAGE", "asynq:default:t:" .. id)
sample_total = sample_total + bytes
end
local n = redis.call("LLEN", "asynq:default:active")
local avg = sample_total / table.getn(ids)
memusg = memusg + (avg * n)
end
local m = redis.call("MEMORY", "USAGE", "asynq:default:active")
if (m) then
memusg = memusg + m
end
end
for i=3,6 do
local ids = redis.call("ZRANGE", "asynq:default:" .. ({"scheduled", "retry", "archived", "completed"})[i - 2], 0, sample_size - 1)
local sample_total = 0
if (table.getn(ids) > 0) then
for _, id in ipairs(ids) do
local bytes = redis.call("MEMORY", "USAGE", "asynq:default:t:" .. id)
sample_total = sample_total + bytes
end
local n = redis.call("ZCARD", "asynq:default:" .. ({"scheduled", "retry", "archived", "completed"})[i - 2])
local avg = sample_total / table.getn(ids)
memusg = memusg + (avg * n)
end
local m = redis.call("MEMORY", "USAGE", "asynq:default:" .. ({"scheduled", "retry", "archived", "completed"})[i - 2])
if (m) then
memusg = memusg + m
end
end
local groups = redis.call("SMEMBERS", "asynq:default:groups")
if table.getn(groups) > 0 then
local agg_task_count = 0
local agg_task_sample_total = 0
local agg_task_sample_size = 0
for i, gname in ipairs(groups) do
local group_key = "asynq:default:g:" .. gname
agg_task_count = agg_task_count + redis.call("ZCARD", group_key)
if i <= tonumber(15) then
local ids = redis.call("ZRANGE", group_key, 0, sample_size - 1)
for _, id in ipairs(ids) do
local bytes = redis.call("MEMORY", "USAGE", "asynq:default:t:" .. id)
agg_task_sample_total = agg_task_sample_total + bytes
agg_task_sample_size = agg_task_sample_size + 1
end
end
end
local avg = agg_task_sample_total / agg_task_sample_size
memusg = memusg + (avg * agg_task_count)
end
return memusg
If so is there some way for me to enable the key being executed in a script?
When using the same application with normal redis it is working without issues.
version: df-v1.13.0-f39eac5bcaf7c8ffe5c433a0e8e15747391199d9