Add channel support to Redis transport#319
Add channel support to Redis transport#319josegonzalez merged 4 commits intopython-beaver:masterfrom hectcastro:hmc/redis-transport-channel
Conversation
This changeset adds support for publishing log entries to a Redis channel, which is also supported by Logstash's Redis input. Beaver configuration files can now supply a `redis_data_type` key. Valid values for this key are `list` and `channel`. If left unset, the default is `list`. Attempts to resolve #266.
beaver/transports/redis_transport.py
Outdated
There was a problem hiding this comment.
Can you move this check outside of the for loop? That way we aren't doing the check for each line.
There was a problem hiding this comment.
Addressed in https://github.com/hectcastro/python-beaver/commit/94812db5e13a95bf20da26bc616e6f12973deff4. Sorry for the original, I wasn't quite sure how to call a method dynamically in Python.
beaver/transports/redis_transport.py
Outdated
There was a problem hiding this comment.
We should do this checking in the __init__, though the method setting can stay here.
Something like:
callback_map = {
'list': pipeline.rpush,
'channel': pipeline.publish,
}
callback_method = callback_map[data_type]
Would be a bit nicer as well.
There was a problem hiding this comment.
Tried to address in https://github.com/hectcastro/python-beaver/commit/39ee609fd9e4d273eb9f3b68a09514c6f9dedf45. Let me know what you think.
|
My only other concern is that instead of being the "data type", why not just call it "redis_transport_method"? Valid methods would be |
|
The main driver for going with |
|
Gotcha, I thought they also supported |
|
From what I've seen in the Logstash Redis input plugin code, |
|
Hmm okay. I'll merge this then. |
Add channel support to Redis transport
This changeset adds support for publishing log entries to a Redis channel, which is also supported by Logstash's Redis input.
Beaver configuration files can now supply a
redis_data_typekey. Valid values for this key arelistandchannel. If left unset, the default islist.Attempts to resolve #266.