• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

RedisLabs/redis-lua-debugger: A Redis Lua script for debugging Redis Lua scripts

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

RedisLabs/redis-lua-debugger

开源软件地址(OpenSource Url):

https://github.com/RedisLabs/redis-lua-debugger

开源编程语言(OpenSource Language):

Lua 100.0%

开源软件介绍(OpenSource Introduction):

redis-lua-debugger

rld is a non-interactive debugger for Lua scripts running in Redis. See this post for a runtime example.

rld's features include:

  • Easy & native installation, only ~6KB payload.
  • Prints output to local and remote consoles.
  • Traces the execution of code lines.
  • State-of-the-art automatic watch mechanism reports new variables and value changes.
  • Reports function calls, returns and arguments and does on-the-fly profiling.

Basic usage

  1. Load rld.lua to Redis once (e.g. redis-cli --eval rld.lua).
  2. Add this line at the beginning of your Lua script: rld.start().
  3. Run your code as usual (e.g. redis-cli --eval prog.lua).
  4. View rld's output in Redis' log file or by subscribing to the rld channel.

API

  • rld.start() - starts the debugger
  • rld.stop() - stops the debugger
  • rld.troff() / rld.tron() - toggles tracing off/on
  • rld.options - debugger options, see source for details

TODO

  • Instead of auto-watch, watch explicit variables by regex (i.e. default is .*)
  • Publish to different channels according to topic (trace, variables,...)
  • Add options arguments to start()

Known Issues

  • This script is not compatible with Redis v3 and above (https://github.com/antirez/redis/commit/30278061cc834b4073b004cb1a2bfb0f195734f7)
  • Last line of user script doesn't trigger auto-watch change printouts
  • Function names are shown without global context (e.g. redis.call becomes call)
  • rld functions are also traced (e.g. calling rld.stop/troff/tron from @user_script)
  • Replication breaker: while the rld script is replicated, it is never run on the slave explicitly and therefore doesn't register in _G. This causes user scripts to break in the slave when trying to invoke rld.

Contributing

  1. Fork it.
  2. Change it.
  3. Make a pull request.

License

See the LICENSE file.

DISCLAIMER

This script is highly experimental - use at your own risk! (and never in production ;))




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
nijie/luahttpd: An efficient HTTP server, using Lua to parse html as the backgro ...发布时间:2022-08-16
下一篇:
tboox/ltui: 发布时间:2022-08-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap