mirror of
https://github.com/elastic/logstash.git
synced 2025-04-25 07:07:54 -04:00
parent
702e69cd6b
commit
a90f56a39c
3 changed files with 35 additions and 12 deletions
|
@ -11,13 +11,19 @@ module LogStash
|
|||
end
|
||||
|
||||
get "/hot_threads" do
|
||||
begin
|
||||
ignore_idle_threads = params["ignore_idle_threads"] || true
|
||||
|
||||
options = { :ignore_idle_threads => as_boolean(ignore_idle_threads) }
|
||||
options = {:ignore_idle_threads => as_boolean(ignore_idle_threads)}
|
||||
options[:threads] = params["threads"].to_i if params.has_key?("threads")
|
||||
|
||||
as = human? ? :string : :json
|
||||
respond_with(node.hot_threads(options), {:as => as})
|
||||
rescue ArgumentError => e
|
||||
response = respond_with({"error" => e.message})
|
||||
status(400)
|
||||
response
|
||||
end
|
||||
end
|
||||
|
||||
get "/pipelines/:id" do
|
||||
|
|
|
@ -9,6 +9,7 @@ module LogStash
|
|||
|
||||
# return hot threads information
|
||||
get "/jvm/hot_threads" do
|
||||
begin
|
||||
top_threads_count = params["threads"] || 3
|
||||
ignore_idle_threads = params["ignore_idle_threads"] || true
|
||||
options = {
|
||||
|
@ -17,6 +18,11 @@ module LogStash
|
|||
}
|
||||
|
||||
respond_with(stats_command.hot_threads(options))
|
||||
rescue ArgumentError => e
|
||||
response = respond_with({"error" => e.message})
|
||||
status(400)
|
||||
response
|
||||
end
|
||||
end
|
||||
|
||||
# return hot threads information
|
||||
|
|
|
@ -46,6 +46,17 @@ describe LogStash::Api::Modules::Node do
|
|||
end
|
||||
end
|
||||
|
||||
context "broken params in URL" do
|
||||
|
||||
before(:all) do
|
||||
get "/hot_threads?human=?threads=5"
|
||||
end
|
||||
|
||||
it "should return http status 400" do
|
||||
expect(last_response.status).to eq(400)
|
||||
end
|
||||
end
|
||||
|
||||
context "when asking for human output" do
|
||||
[
|
||||
"/hot_threads?human",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue