-
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
Lifecycle method called correctly once #1242
Conversation
* outputs of multi_output are added into @outputs, in #add_match
…eated/configured in dynamic way * when plugins created dynamically, its child output plugins are not registered in agent, and out of #lifecycle target * so these plugins should be controlled by MultiOutput plugins This fix is for configurations using fluent-plugin-forest and similar plugins, with "copy" as its sub-store.
@repeatedly Could you review this change? |
It seems good. Removing |
@@ -137,7 +131,12 @@ def add_match(type, pattern, conf) | |||
@outputs << output | |||
if output.respond_to?(:outputs) && (output.respond_to?(:multi_output?) && output.multi_output? || output.is_a?(Fluent::MultiOutput)) |
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.
Another topic.
I noticed adding Fluent::MultiOutput
's outputs
seems wrong.
v0.12 MultiOutput
calls plugin's start
/shutdown
directly, so
it causes double lifecycle sequence calls silently.
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.
Hmm, looks right.
@repeatedly updated this change. |
@repeatedly ping. |
LGTM |
This change is to fix both of #1161 and #1222.
To fix #1222, RootAgent (and Agent) should not retrieve
outputs
of output plugins dynamically in#lifecycle
. Removing it solves the problem to call shutdown methods twice.But this fix re-opens #1161 problem.
If all plugins are flat/static plugins or MultiOutput plugins which initialize all stores by static configuration, all plugin instances are registered in
agent.outputs
.But once MultiOutput plugin is initialized dynamically by any plugins (e.g., fluent-plugin-forest), its sub-store/sub-plugin instances are not registered in
agent.outputs
. Lifecycle methods of these plugins are never called.This change will add a feature to call lifecycle methods in MultiOutput. It's a kind of dirty workaround, but works well.