-
Notifications
You must be signed in to change notification settings - Fork 70
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
List pattern support #81
base: main
Are you sure you want to change the base?
Conversation
💚 CLA has been signed |
a26004a
to
12e270c
Compare
@juusom im unable to get this to work after installing Redis Key:
|
Thanks for your interest in this @bbmhmmad! In your config snippet, the data type is wrong. It should be |
a4fb749
to
40c52e9
Compare
Add support for reading from list patterns such as
logstash.*
. Related issue: #49The motivation in our case is that we want to be able to see and control when individual applications produce spammy logs for whatever reason. In those situations, it's also important to be able to guarantee some level of fairness when consuming the queues, as opposed to having just one queue dominated by a potentially misbehaving application.
The implementation supports consuming single items per list using
LPOP
, as well as batched consuming using the sameEVAL
based logic as the regularlist
data_type
input.The logic is based on using a configurable-size concurrent-ruby thread pool. The main loop keeps polling the key pattern using the
KEYS
command and whenever the thread pool queue isn't full, posts a new job to the thread pool for consuming a single key. It keeps track of the keys currently queued and makes sure there's only one job per key at a time.I also did some refactoring and wanted to do more but decided to make this PR before going further in order to get some opinions.
So far I extracted the Redis connection logic as a MixIn - it's all in a single commit and can be reverted if need be.(edit: scratch that, I reverted this bit already, for now) What I'd like to do is make all the 3 different use cases (list, pattern list, PubSub) independent classes implementing an interface. It's currently quite messy with so much unrelated code in a single class.I'm not a Ruby developer (although I did gather input from colleagues who are) so let me know if there's anything silly, or if this somehow violates any logstash/elastic practices :)