oliver006 / redis_exporter

Prometheus Exporter for ValKey & Redis Metrics. Supports ValKey and Redis 2.x, 3.x, 4.x, 5.x, 6.x, and 7.x
https://github.com/oliver006/redis_exporter
MIT License
3.12k stars 876 forks source link

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

Closed jcaspes closed 8 months ago

jcaspes commented 9 months ago

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 ;-) https://github.com/oliver006/redis_exporter/pull/860

oliver006 commented 8 months ago

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