-
Notifications
You must be signed in to change notification settings - Fork 166
Add channel support to Redis transport #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add channel support to Redis transport #319
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.