Skip to content

Commit

Permalink
MINOR: Remove ununsed methods from java_pipeline.rb and pipeline.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
original-brownbear committed Apr 30, 2018
1 parent f4603f9 commit 1de8d72
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 33 deletions.
35 changes: 8 additions & 27 deletions logstash-core/lib/logstash/java_pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ def initialize(pipeline_config, namespaced_metric = nil, agent = nil)
)

@pipeline_id = @settings.get_value("pipeline.id") || self.object_id
@agent = agent
@dlq_writer = dlq_writer
@plugin_factory = LogStash::Plugins::PluginFactory.new(
# use NullMetric if called in the BasePipeline context otherwise use the @metric value
@lir, LogStash::Plugins::PluginMetricFactory.new(pipeline_id, @metric || Instrument::NullMetric.new),
LogStash::Plugins::ExecutionContextFactory.new(@agent, self, @dlq_writer),
JavaFilterDelegator
@lir_execution = CompiledPipeline.new(
@lir,
LogStash::Plugins::PluginFactory.new(
# use NullMetric if called in the BasePipeline context otherwise use the @metric value
@lir, LogStash::Plugins::PluginMetricFactory.new(pipeline_id, @metric),
LogStash::Plugins::ExecutionContextFactory.new(agent, self, @dlq_writer),
JavaFilterDelegator
)
)
@lir_execution = CompiledPipeline.new(@lir, @plugin_factory)
if settings.get_value("config.debug") && @logger.debug?
@logger.debug("Compiled pipeline code", default_logging_keys(:code => @lir.get_graph.to_string))
end
Expand All @@ -70,26 +71,6 @@ def close_dlq_writer
end
end

def buildOutput(name, line, column, *args)
plugin("output", name, line, column, *args)
end

def buildFilter(name, line, column, *args)
plugin("filter", name, line, column, *args)
end

def buildInput(name, line, column, *args)
plugin("input", name, line, column, *args)
end

def buildCodec(name, *args)
plugin("codec", name, 0, 0, *args)
end

def plugin(plugin_type, name, line, column, *args)
@plugin_factory.plugin(plugin_type, name, line, column, *args)
end

def reloadable?
configured_as_reloadable? && reloadable_plugins?
end
Expand Down
11 changes: 6 additions & 5 deletions logstash-core/lib/logstash/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def initialize(pipeline_config, namespaced_metric = nil, agent = nil)

@plugin_factory = LogStash::Plugins::PluginFactory.new(
# use NullMetric if called in the BasePipeline context otherwise use the @metric value
@lir, LogStash::Plugins::PluginMetricFactory.new(pipeline_id, @metric || Instrument::NullMetric.new),
@lir, LogStash::Plugins::PluginMetricFactory.new(pipeline_id, @metric),
LogStash::Plugins::ExecutionContextFactory.new(@agent, self, @dlq_writer),
FilterDelegator
)
Expand Down Expand Up @@ -98,10 +98,6 @@ def compile_lir
)
end

def plugin(plugin_type, name, line, column, *args)
@plugin_factory.plugin(plugin_type, name, line, column, *args)
end

def reloadable?
configured_as_reloadable? && reloadable_plugins?
end
Expand All @@ -120,6 +116,11 @@ def non_reloadable_plugins

private


def plugin(plugin_type, name, line, column, *args)
@plugin_factory.plugin(plugin_type, name, line, column, *args)
end

def default_logging_keys(other_keys = {})
{ :pipeline_id => pipeline_id }.merge(other_keys)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.logstash.execution.ExecutionContextExt;
import org.logstash.instrument.metrics.AbstractMetricExt;
import org.logstash.instrument.metrics.AbstractNamespacedMetricExt;
import org.logstash.instrument.metrics.NullMetricExt;

public final class PluginFactoryExt {

Expand Down Expand Up @@ -71,7 +72,11 @@ public Metrics(final Ruby runtime, final RubyClass metaClass) {
public PluginFactoryExt.Metrics initialize(final ThreadContext context,
final IRubyObject pipelineId, final IRubyObject metrics) {
this.pipelineId = pipelineId.convertToString().intern19();
this.metric = (AbstractMetricExt) metrics;
if (metrics.isNil()) {
this.metric = new NullMetricExt(context.runtime, RubyUtil.NULL_METRIC_CLASS);
} else {
this.metric = (AbstractMetricExt) metrics;
}
return this;
}

Expand Down

0 comments on commit 1de8d72

Please sign in to comment.