-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 new Plugin::Base class and PluginHelper modules #843
Conversation
First bunch is for:
|
b4c74e7
to
54fe3aa
Compare
f3661ba
to
d894f78
Compare
@@ -35,24 +35,6 @@ class Plugin | |||
|
|||
REGISTRIES = [INPUT_REGISTRY, OUTPUT_REGISTRY, FILTER_REGISTRY, BUFFER_REGISTRY, PARSER_REGISTRY, FORMATTER_REGISTRY] | |||
|
|||
def self.lookup_type_from_class(klass_or_its_name) |
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.
Methods for internal use should be under public use.
@repeatedly please take a glance before merge. |
@@ -245,6 +245,10 @@ def flush | |||
@out.flush | |||
end | |||
|
|||
def reset | |||
@out.reset if @out.respond_to?(:reset) |
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.
IO object doesn't have reset
method.
What the object do you assume?
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.
Ah, Is this for test purpose?
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.
Yes. This is to initialize lines in logger between tests.
yield *t_args | ||
thread_exit = true | ||
rescue => e | ||
log.warn "thread exited by unexpected error", plugin: self.class, title: title, error_class: e.class, error: e |
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.
should set true
to thread_exit
?
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.
Correct.
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.
Fixed.
c8023cd
to
89274c9
Compare
I pushed fixed for comments. |
@_event_loop = nil | ||
@_event_loop_running = false | ||
@_event_loop_mutex = nil | ||
@_event_loop_run_timeout = EVENT_LOOP_RUN_DEFAULT_TIMEOUT |
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.
Resetting this value is needed?
If needed, nil
is better?
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.
Correct. nil
is better.
In basic design of new plugin API, plugins should be re-initialized after terminate
. It's good for many things including tests.
89274c9
to
6271788
Compare
I pushed more fixes again. |
9cad06f
to
942b04b
Compare
Now it's green on CIs. |
Merged! |
PluginHelper provides utilities to write plugins:
And change Fluent::Plugin from class to module (because it can't be instantiated) and add Fluent::Plugin::Base class as a base class of all plugins, to define methods for plugin life cycles which are used from plugin helpers.