Code review

Fixes #5446
This commit is contained in:
Pier-Hugues Pellerin 2016-06-06 09:59:16 -04:00
parent 6acbdc3015
commit a741534f7c
5 changed files with 13 additions and 18 deletions

View file

@ -113,13 +113,13 @@ class LogStash::Agent
((Time.now.to_f - STARTED_AT.to_f) * 1000.0).to_i
end
def stop_collecting_metric
def stop_collecting_metrics
@collector.stop
@periodic_pollers.stop
end
def shutdown
stop_collecting_metric
stop_collecting_metrics
stop_webserver
shutdown_pipelines
end
@ -164,7 +164,7 @@ class LogStash::Agent
end
def reset_metrics_collectors
stop_collecting_metric
stop_collecting_metrics
configure_metrics_collectors
end
@ -266,8 +266,6 @@ class LogStash::Agent
def upgrade_pipeline(pipeline_id, new_pipeline)
stop_pipeline(pipeline_id)
@pipelines[pipeline_id] = new_pipeline
new_pipeline = metric
start_pipeline(pipeline_id)
end

View file

@ -104,7 +104,7 @@ module LogStash
"/_node" => LogStash::Api::Modules::Node,
"/_stats" => LogStash::Api::Modules::Stats,
"/_node/stats" => LogStash::Api::Modules::NodeStats,
"/_plugins" => LogStash::Api::Modules::Plugins,
"/_plugins" => LogStash::Api::Modules::Plugins
}
end
end

View file

@ -35,12 +35,6 @@ module LogStash
end
LogStash::Json.dump(data)
end
private
def has_counters?
true
end
end
end
end

View file

@ -41,7 +41,7 @@ module LogStash; class Pipeline
"LogStash::Inputs::Stdin"
]
def initialize(config_str, settings = LogStash::SETTINGS, provided_metric = nil)
def initialize(config_str, settings = LogStash::SETTINGS, namespaced_metric = nil)
@config_str = config_str
@logger = Cabin::Channel.get(LogStash)
@settings = settings
@ -56,7 +56,7 @@ module LogStash; class Pipeline
# This needs to be configured before we evaluate the code to make
# sure the metric instance is correctly send to the plugins to make the namespace scoping work
@metric = provided_metric.nil? ? LogStash::Instrument::NullMetric.new : provided_metric
@metric = namespaced_metric.nil? ? LogStash::Instrument::NullMetric.new : namespaced_metric
grammar = LogStashConfigParser.new
@config = grammar.parse(config_str)

View file

@ -381,11 +381,14 @@ describe LogStash::Agent do
end
after :each do
begin
subject.shutdown
Stud.stop!(@t)
@t.join
ensure
Thread.abort_on_exception = @abort_on_exception
end
end
it "resets the metric collector" do
# We know that the store has more events coming in.