Add reload stats at the instance level

Reload stats are currently reported at the pipeline level. The instance
level aggregates these stats across the pipelines

Fixes #6350

Fixes #6367
This commit is contained in:
Suyog Rao 2016-12-06 17:13:24 -08:00
parent 134795360c
commit c8826b81ab
4 changed files with 31 additions and 1 deletions

21
Gemfile
View file

@ -116,3 +116,24 @@ gem "logstash-output-stdout"
gem "logstash-output-tcp"
gem "logstash-output-udp"
gem "logstash-output-webhdfs"
gem "logstash-filter-multiline"
gem "jar-dependencies", ">= 0"
gem "ruby-maven", "~> 3.3"
gem "logstash-patterns-core", ">= 0"
gem "pry", ">= 0"
gem "rspec-wait", ">= 0"
gem "childprocess", ">= 0"
gem "ftw", "~> 0.0.42"
gem "rspec-sequencing", ">= 0"
gem "gmetric", ">= 0"
gem "gelf", "= 1.3.2"
gem "timecop", ">= 0"
gem "jdbc-derby", ">= 0"
gem "coveralls", ">= 0"
gem "addressable", "~> 2.3.0"
gem "elasticsearch", ">= 0"
gem "sinatra", ">= 0"
gem "webrick", ">= 0"
gem "poseidon", ">= 0"
gem "snappy", ">= 0"
gem "webmock", "~> 1.21.0"

View file

@ -80,7 +80,11 @@ describe LogStash::Api::Modules::NodeStats do
"filtered" => Numeric,
"out" => Numeric
}
}
},
"reloads" => {
"successes" => Numeric,
"failures" => Numeric
}
}
test_api_and_resources(root_structure)

View file

@ -479,7 +479,9 @@ describe LogStash::Agent do
it "increases the successful reload count" do
snapshot = subject.metric.collector.snapshot_metric
value = snapshot.metric_store.get_with_path("/stats/pipelines")[:stats][:pipelines][:main][:reloads][:successes].value
instance_value = snapshot.metric_store.get_with_path("/stats")[:stats][:reloads][:successes].value
expect(value).to eq(1)
expect(instance_value).to eq(1)
end
it "does not set the failure reload timestamp" do

View file

@ -64,11 +64,14 @@ describe "Test Logstash service when config reload is enabled" do
# check reload stats
reload_stats = logstash_service.monitoring_api.pipeline_stats["reloads"]
instance_reload_stats = logstash_service.monitoring_api.node_stats["reloads"]
expect(reload_stats["successes"]).to eq(1)
expect(reload_stats["failures"]).to eq(0)
expect(reload_stats["last_success_timestamp"].blank?).to be false
expect(reload_stats["last_error"]).to eq(nil)
expect(instance_reload_stats["successes"]).to eq(1)
expect(instance_reload_stats["failures"]).to eq(0)
# parse the results and validate
re = JSON.load(File.new(output_file2))
expect(re["clientip"]).to eq("74.125.176.147")