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

Native support for Java plugins (GA) #10620

Closed
wants to merge 1 commit into from
Closed

Native support for Java plugins (GA) #10620

wants to merge 1 commit into from

Conversation

danhermann
Copy link
Contributor

@danhermann danhermann commented Apr 1, 2019

Changes to Java plugins for GA include:

  • BREAKING: The signature for the codec.encode() method was changed to make the codec API easier to use correctly in pipelines with multiple concurrent workers.
  • BETA: Isolated classloader for Java plugins. When enabled with the pipeline.plugin_classloaders flag, each Java plugin will be loaded with its own parent-last classloader. All dependencies for the Java plugin, with the exception of any classes in org.logstash.* or co.elastic.logstash.* packages, will be loaded first from the plugin's jar file delegating to the main Logstash classloader only if the dependency is not found within the plugin's jar. This allows Java plugins to use dependencies that might clash with the dependencies for other Java plugins or Logstash core itself.
  • Gradle tasks to automate the packaging of Java plugins as Ruby gems. The gem task will bootstrap all JRuby dependencies, automatically generate Gemfile and the gemspec file for the plugin as well as the two "glue" Ruby source files for triggering the loading of the Java class files during Logstash startup, and then invoke the necessary commands to create the gem file itself. The gem task also performs a number of validation checks to proactively identify common problems with the packaging of Java plugins. The clean task will remove all of those generated artifacts.
  • Java plugin validation. At pipeline startup, all Java plugins will be checked to ensure that they implement the same version of the Java plugin API present in the current Logstash version.
  • New built-in Java plugins:
    • A Java-based generator input for testing with the same capabilities as the Ruby generator input as well as an optional eps option to generate events at a given event-per-second rate for situations where as-fast-as-possible event generation is too much.
    • Also includes a jdots codec that mirrors the Ruby dots codec.
    • Java-based sink output that discards any events received. Analogous to the Ruby null plugin though much faster.
  • Float, URI, and password config types, each of which provide validation for the supplied config value.

@danhermann
Copy link
Contributor Author

@karenzone, could you review the doc updates for the GA release of Java plugins in this commit? fd425b4

Copy link
Contributor

@karenzone karenzone left a comment

Choose a reason for hiding this comment

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

Docs build cleanly and LGTM

Copy link
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

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

This looks fantastic.

I've left a few comments in-line. My primary concerns are:

  1. upgrade pain for those using the Beta API already, since this does include breaking changes
  2. continued use of CharsetEncoder and CharsetDecoder in our example codecs, since they are stateful and we require that implementations of Codec be stateless.
  3. can users still get themselves into a tight spot with silent failures by enabling the deprecated ruby execution engine, or do we provide helpful feedback?

@danhermann
Copy link
Contributor Author

@yaauie, thank you for the detailed review. I've made all the improvements you suggested. You might want to take a look at the updated validation for the jar file name in Java plugins in registry.rb (here) and let me know where you would like to see the breaking API change documented.

@danhermann danhermann added v7.2.0 and removed v7.1.0 labels May 1, 2019
Copy link
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

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

One nitpick about a final, otherwise this looks good to go.

LGTM.

private String id;
private long threads;
private volatile boolean stopRequested = false;
private CountDownLatch countDownLatch;
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: can now be final

… adds float config type

* Breaking change to codec.encode method

* Sink output for discarding events

* URI and password config types

* Utility methods for packaging Java plugins

* Plugin API validation, fix gemspec generation

* Plugin Jar validation

* Update developer documentation

* Update codec metrics for new encode method

* Beta: Isolated classloaders for Java plugins

* Address code review comments
@elasticsearch-bot
Copy link

Dan Hermann merged this into the following branches!

Branch Commits
master 0de5393
7.x 3fba3af

elasticsearch-bot pushed a commit that referenced this pull request May 3, 2019
… adds float config type

* Breaking change to codec.encode method

* Sink output for discarding events

* URI and password config types

* Utility methods for packaging Java plugins

* Plugin API validation, fix gemspec generation

* Plugin Jar validation

* Update developer documentation

* Update codec metrics for new encode method

* Beta: Isolated classloaders for Java plugins

* Address code review comments

Fixes #10620
@danhermann
Copy link
Contributor Author

Thanks again for the review, @yaauie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants