oliver006/redis_exporter

check-key-groups / MEMORY USAGE / Redis version < 4

jcaspes opened this issue · 1 comments

Describe the problem
Hello, i'm using redis_exporter on redis 3.2.4 with check-key-groups option to have metrics on keys.
But on this redis version exporter report an error un lua script:
time="2023-12-13T16:04:14+01:00" level=error msg="ERR Error running script (call to f_300c37a161a7b9fab171e2f65a4a999e33a3e3fe): @user_script:19: @user_script: 19: Unknown Redis command called from Lua script "
After debugging the script it appear that the error come from MEMORY USAGE command that is available only since redis v 4.0
https://redis.io/commands/memory-usage/

What version of redis_exporter are you running?
[ ] 1.54.0

Running the exporter
redis_exporter.exe --redis.addr=127.0.0.1:324 --web.listen-address=:9292 --check-key-groups="^([^:]).$" --max-distinct-key-groups=200 --redis-only-metrics

Idea
I've tried a fix by using redis.pcall that allow to handle errors and avoid script to stop.
This allow to have a limited metrics (count only) for redis version < 4

I've created a pull request for this here ;-)
#860

This was fixed by #860 - thanks for your PR!