-
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
[WIP] refactor input plugin and pipeline shutdown #3211
Conversation
some of the design goals, excluding better semantic and simplification are:
while !stop?
... read ...
end I wanted to make sure the We can see that volatile reads are obviously slower than a bare instance variable read. But we can also see that we can achieve ~5.5M iterations per seconds. This is about 2 order of magnitudes faster than the pipeline throughput so the impact on the pipeline of calling |
To make all plugins consistent, the bookkeeping method should remain "teardown" in the inputs/base.rb. The job of However, to reduce the amount of code a user has to write if he wants to add behaviour to teardown, all So, instead of this proposal of: control +c -> (pipeline) calls stop on inputs -> each input sets stop? == true -> input exits #run -> input worker calls plugin.close could be: control +c -> (pipeline) calls stop on inputs -> each input sets stop? == true -> input exits #run -> input worker calls plugin.close -> plugin calls teardown on self This way a user doesn't have to remind him/herself to call super, and all plugins use |
Also, I'd suggest renaming |
def teardown | ||
# nothing by default | ||
finished | ||
# if you override stop, don't forgt to call super |
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.
s/forgt/forget
def to_s | ||
return "#{self.class.name}: #{@params}" | ||
# if you override close, don't forgt to call super | ||
def close |
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.
@colinsurprenant I know we've had this conversation but can this method be named teardown so all cleanup methods are consistently named across plugin types (filters and outputs still use teardown)?
My two reasons for making this teardown are:
- less changes needed: otherwise we need to refactor all plugins that define
teardown
to useclose
instead - arguably a better metaphor:
close
might make sense in plugins such as tcp/udp where you cleanup by closing a socket, but in others the plugin isn't actually closing anything. Thereforeteardown
(pronunciation) is more suitable, used commonly in test suites to convey the "cleanup" action.
Another step to do: remove all calls to
|
Closing this in lieu of #3895 |
logstash/pipeline.rb
andlogstash/plugin.rb