Skip to content
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

Compatibility layers for v0.12 plugins #912

Merged
merged 22 commits into from
May 17, 2016
Merged

Compatibility layers for v0.12 plugins #912

merged 22 commits into from
May 17, 2016

Conversation

tagomoris
Copy link
Member

This change provides compatibility layers for v0.12 style plugins of:

  • Input
  • Output
  • Filter

And this change also replaces default buffer plugins to v0.14 implementations.

@tagomoris tagomoris force-pushed the compat-plugins-v12 branch 3 times, most recently from 9e5813d to 6529a5b Compare April 27, 2016 02:38
@tagomoris tagomoris force-pushed the compat-plugins-v12 branch from 6529a5b to 15febd2 Compare April 27, 2016 13:36
@tagomoris tagomoris changed the title [WIP] Compatibility layers for v0.12 plugins Compatibility layers for v0.12 plugins Apr 27, 2016
@tagomoris
Copy link
Member Author

tagomoris commented Apr 27, 2016

I've done for almost all tasks for v0.14 plugin APIs.
The rest thing is:

  • remove Fluent::Buffer and its subclasses fluent/plugin/buf_memory.rb and buf_file, and these tests
  • rename buf_memory2.rb and buf_file2.rb to buf_memory.rb and buf_file
  • update few default values of memory2, file2
  • fix plugin shutdown sequence with new methods (stop/after_shutdown/close/terminate)

@tagomoris
Copy link
Member Author

I think startup/shutdown sequence need this hack: https://gist.github.com/unak/f36def728e8c5411eff8

@tagomoris
Copy link
Member Author

@repeatedly @sonots Anyway, could you review this change?

@tagomoris tagomoris force-pushed the compat-plugins-v12 branch from 15febd2 to e3f04ff Compare April 28, 2016 02:03
@buffer.symlink_path = @symlink_path if @symlink_path
if @symlink_path && @buffer.respond_to?(:path)
(class << @buffer; self; end).module_eval do
prepend SymlinkBufferMixin
Copy link
Member

@repeatedly repeatedly Apr 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepend doesn't work on Ruby 1.9 so this code should not be backported to v0.12, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't add label v0.12 on this pull-request... and this hack is required because Buffer plugin of v0.14 API doesn't have symbolic link feature.
There's no reason to backport this change to v0.12.

Copy link
Member

@repeatedly repeatedly Apr 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is this plugin is also used in v0.12.
So if someone writes the patch to v0.12 / v0.14 out_file, v0.14 changes may conflict.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicts may occur if someone want to change L90 (in previous version), but any other changes will not conflict this change.


secconf = CompatOutputUtils.secondary_section(conf)
if secconf
if secconf['type'] && !secconf['@type']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines could be moved to secondary_section method?
And I want to log warning like 'type' is deprecated. 'type' parameter will be ignored since v1. Use @type instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO changing conf object should be done in configure method explicitly, not in CompatOutputUtils.secondary_section (in implicit way), for readability.
Showing type deprecation looks good idea.

Copy link
Member

@repeatedly repeatedly May 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my view, this modification is for backward compatibility, not actual plugin's behaviour.
So helper method can hide such dirty code from plugin code.
I think this is also readable for non-core developers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it should be readable only for core-developers, and I think it's easy to understand for me.

Copy link
Member

@repeatedly repeatedly May 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think easy to understand for me.

@sonots What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not so strong opinion, but if I were you, I put them into secondary_section method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added an another method for obsoleted type handling.

@tagomoris
Copy link
Member Author

I will merge this change after CI green unless further comments exist.

@tagomoris tagomoris force-pushed the compat-plugins-v12 branch from dacbfff to a424505 Compare May 13, 2016 10:28
@tagomoris tagomoris merged commit 719dff4 into master May 17, 2016
@tagomoris tagomoris deleted the compat-plugins-v12 branch May 17, 2016 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants