File: collect_lists_length_growing.lua

package info (click to toggle)
prometheus-redis-exporter 1.69.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 768 kB
  • sloc: makefile: 121; sh: 92
file content (26 lines) | stat: -rw-r--r-- 638 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local result = {}

local function lengthOfList (key)
  return redis.call("LLEN", key)
end

redis.call("SELECT", DB_NO)

local keysPresent = redis.call("KEYS", "KEYS_PATTERN")

if keysPresent ~= nil then
    for _,key in ipairs(keysPresent) do

        --error catching and status=true for success calls
     	local status, retval = pcall(lengthOfList, key)

     	if status == true then
            local keyName = "redis_list_length_" .. key
            local keyValue = retval .. ""
    		table.insert(result, keyName) -- store the keyname
         	table.insert(result, keyValue) --store the bit count
		end
    end
end

return result