-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Adapt plugins to new Plugin API introduced by #3210 #3813
Comments
Awesome @jsvd! |
@jsvd thanks for the detailed analysis! I added 2 more points at the end |
For all interested in testing this:
|
@jsvd work on a few inputs here, waiting to get more feedback from you before moving forward with more. Open question for me here is how deep to go on the "cleanup" ? 😸 |
before moving forward too deep (in particular for @purbon we should avoid mixing cleanup & refactor work. one or the other but not both in the same PR, start with refactor since this is what is required here. after we can add/merge cleanups. |
please note that some input plugins might need special handling/testing for when in blocked IO state to see if they can be unblocked from the pipeline thread form the |
@colinsurprenant indeed. the one exception I'm not worried about is the logstash-input-stdin, since it's equally non interruptible with both the new and old apis. Even with the PR you created to use the java interopt to extract the channel and make it interruptible, it's a non breaking change so it doesn't need to be rushed, IMO. |
@jsvd +1 |
@colinsurprenant sorry to bump in, but as you are planning this huge refactoring, could you consider adding the small refactor described in #2447 about abstracting into base how to send an event to the filterworker(s) instead of exposing the queue in the run method. IMHO this could be the baseline for future enhancement on how inputs would be submitting events to the pipeline and allow to centralize ideas about detection/handling of back-pressure, batching of event, prioritization, dispatching, queue persistence etc etc. Thanks for reading! |
@jsvd @ph @jordansissel could use a review(s) of jordansissel/ruby-stud#27 to move forward with all plugins using |
Is there a reason that 'stop' and 'close' have different names? I think this will be very confusing to future plugin authors. It's already confusing to me now. Ideally they would both also make |
I think I think it would be ok to rename what do you think? |
@talevy I'm not clear on why they need to call super? Presuming that they don't ever check |
I don't like the fact that people who wish to use |
@talevy I misread your original comment. I do think we should have another function called externally that makes |
disagree on the naming :) but yeah, that is what I meant! |
@talevy I meant |
Ref elastic/logstash#3813 Fixes #3
all default plugins now have been refactored to address the new api. |
Issue #3210 and PR
#3812#3895 change the Plugin API to:stop
(public),stop?
(public) to LogStash::Inputs::Baseteardown
toclose
shutdown
,finished
.finished?
,running?
,terminating?
from LogStash::PluginRefactor work needed on the plugins
Input plugins
Input plugins are now shutdown by an external call to
plugin.stop
instead of catching LogStash::ShutdownSignal exception.Unless overridden,
stop
will simply makesstop?
returntrue
, thus allowingrun
to poll this and return after seeing the change.In some plugins extra work must be done in
stop
to instructrun
that it's time to return. For example, in thelogstash-input-udp
it's necessary to call@socket.close
to make the blocking read on the socket raise an exception, thus breaking out the loop.So, different input plugins will require different
stop
strategies.Refactoring an input plugin involves:
ShutdownSignal
exceptionrun
loop: is it awhile
? aconsumer.subscribe {|event| }
? is there a blocking operation on a socket/fd?stop?
and/or overridestop
to make run returnclose
(currently done inteardown
)shutdown
,finished
,finished?
,running?
orterminating?
Then for testing you can use the shared example provided in elastic/logstash-devutils#32 in the following manner:
Testing the refactor
bundle install
bundle exec rspec
Filters and Outputs
Both will still shutdown using the ShutdownEvent sent by the pipeline so no major changes necessary.
The work in these plugins is:
shutdown
,finished
,finished?
,running?
orterminating?
teardown
toclose
Work To Do
1. Input plugins
1.1 Default Input Plugins
stop
semantics logstash-plugins/logstash-input-twitter#281. Remove
shutdown
Nothing to do.
2. Remove
finished
3. Remove
finished?
Nothing to do.
4. Remove
running?
Nothing to do.
5. Remove
terminating?
Nothing to do.
6. Rename
teardown
toclose
Issue #3952 tracks this
7. Other tasks
The text was updated successfully, but these errors were encountered: