$ redis-cli -eval Redis_queue.lua
Lua script for redis_exporter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local result = {} | |
local cur = "0" | |
local pat = "*:queue" | |
local keys = nil | |
local done = false | |
local t = redis.call('TIME') | |
repeat | |
local r = redis.call("SCAN", cur, "MATCH", pat); | |
cur = r[1] | |
keys = r[2] | |
for _, v in ipairs(keys) do | |
local z = redis.call("ZCOUNT", v, '0', t[1]) | |
table.insert(result, v) | |
table.insert(result, tostring(z)) | |
end | |
if cur == "0" then | |
done = true | |
end | |
until done | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment