-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Simplify Pipeline class Hierarchy #14551
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
Conversation
Build failed fetching integration resources. Jenkins test this again please |
Build will continue to fail until daily snapshots are available for Elasticsearch's newly-cut branch of 8.6, which could be up to 24h. I will follow up tomorrow to kick off CI again. |
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.
Put nice to have a doc comment and if we can remove unused params but feel free to merge if we can cover next PRs. Current PR's goal to get rid of JavaBaselinePipeline
.
* JRuby extension to provide ancestor class for the ruby-defined {@code LogStash::JavaPipeline} class. | ||
* | ||
* <p>NOTE: Although this class' name implies that it is "abstract", we instantiated it directly | ||
* as a lightweight temporary-scoped pipeline in the ruby-defined {@code LogStash::PipelineAction::Reload} | ||
* */ | ||
@JRubyClass(name = "AbstractPipeline") | ||
public class AbstractPipelineExt extends RubyBasicObject { |
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.
Thanks for the effort @yaauie !
+1 for removing JavaBasePipelineExt.java
and it seems it even doesn't have any test cases.
Out of scope: how do you think for the long term dividing this class into domains:
- DLQ features (with its metrics)
- Stats metrics
- Pipeline related (reloadable, close, etc...)
We probably need to change the inheritance to include java class if we divide (or extend interface if Ruby/JRuby supports).
I would also argue calling this class abstract
(it doesn't in a reality). Maybe candidates: PipelineExtension
/PipelineDomain
/PipelineService
.
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.
I am leaning toward BasePipeline
, since it is not abstract. After we have a green CI pass here, I will perform another automated-rename in a separate commit.
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.
I do not have any specific plans for the cleanup of this class and rearrangement. This PR is one step to remove the hierarchy, and everything else is out of scope.
|
||
public AbstractPipelineExt(final Ruby runtime, final RubyClass metaClass) { | ||
super(runtime, metaClass); | ||
} | ||
|
||
@JRubyMethod(required = 4) | ||
public AbstractPipelineExt initialize(final ThreadContext context, final IRubyObject[] args) |
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.
Can we have a documentation for this method? I really confuse whenever I do see at this. We have a caller in reload.rb:L51
LogStash::AbstractPipeline.new(@pipeline_config, nil, logger, nil)
If we do not use args[1]
& args[3]
as they are nil, why don't we remove?
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.
As stated in the PR, this is a net-zero-change PR, very intentionally designed to change only the hierarchy using automated code tools and as little manual intervention as possible.
I have very little idea what several of these pieces do, and we will have opportunity to refactor and consolidate separately.
It looks like we have a Stack 8.6 snapshot now. Jenkins test this again please |
Release notes
[rn: skip]
What does this PR do?
Simplifies the inheritance hierarchy of our
LogStash::JavaPipeline
using nearly-entirely-automated code tools. This is a net-zero-change pull-request.This removes artifacts of the current only-pipeline implementation used by our only-execution engine (previously Java Execution Engine, or JEE) needing to share context with the now-removed
LogStash::Pipeline
that was integral to the deprecated-and-removed Ruby Execution Engine (REE).JavaBasePipelineExt
into its parentAbstractPipelineExt
LOGGER
and an identicalserialVersionUID
, which were manually consolidatedJavaBasePipelineExt
LogStash::JavaPipeline
inherit directly from our newly-consolidatedAbstractPipelineExt
JavaBasePipelineExt
to its parentAbstractPipelineExt
JavaBasePipelineExt
, ensuring no dangling code-references to its ruby formLogStash::JavaBasePipeline
Why is it important/What is the impact to the user?
Simplifies our maintenance footprint, and opens the door for future refactors that can further consolidate or clean up the pipeline's implementation.
Prior to this change, our pipeline code was split between three places:
LogStash::JavaPipeline
org.logstash.execution.JavaBasePipelineExt
org.logstash.execution.AbstractPipelineExt
org.jruby.RubyBasicObject
After this change, our pipeline code is one step simpler:
LogStash::JavaPipeline
org.logstash.execution.AbstractPipelineExt
org.jruby.RubyBasicObject
OUT OF SCOPE: the resulting combined
AbstractPipelineExt
class is certainly convoluted, and contains significant duplication, but is effectively identical to the existing as-composedJavaBasePipeline
and resolving the complexity and/or duplication is out of scope.Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files (and/or docker env variables)How to test this PR locally
As a net-zero-change PR, there is no specific way to validate.