skylightio/skylight-ruby — pull request #6 by brandonweiss (2014-04-09 03:30:44+00:00)
Title: Creating a probe for instrumenting Redis

It took me a while to figure out how to get a Vagrant box up in order to run the tests and start working on it, but here it is.

The way I stubbed out Redis is pretty janky. My understanding is that Redis communicates over a socket, so I tried to figure out how to start a `TCPServer` that Redis could connect to and would respond with `"+OK\r\n"`, which is apparently a successful response in the protocol. But I've never worked directly with sockets before, and I couldn't figure out how to do it short of spinning up a thread so it wouldn't block. So I just stubbed it in such a way that I could expect the write to the socket as it happened.

Thoughts?