List pattern support#81
Open
juusom wants to merge 6 commits into
Open
Conversation
added 2 commits
April 7, 2020 14:53
|
💚 CLA has been signed |
a26004a to
12e270c
Compare
|
@juusom im unable to get this to work after installing Redis Key: |
Author
|
Thanks for your interest in this @bbmhmmad! In your config snippet, the data type is wrong. It should be |
a4fb749 to
40c52e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 sameEVALbased logic as the regularlistdata_typeinput.The logic is based on using a configurable-size concurrent-ruby thread pool. The main loop keeps polling the key pattern using the
KEYScommand 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 :)