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,6 +11,7 @@ module LogStash
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/hot_threads" do
|
get "/hot_threads" do
|
||||||
|
begin
|
||||||
ignore_idle_threads = params["ignore_idle_threads"] || true
|
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)}
|
||||||
|
@ -18,6 +19,11 @@ module LogStash
|
||||||
|
|
||||||
as = human? ? :string : :json
|
as = human? ? :string : :json
|
||||||
respond_with(node.hot_threads(options), {:as => as})
|
respond_with(node.hot_threads(options), {:as => as})
|
||||||
|
rescue ArgumentError => e
|
||||||
|
response = respond_with({"error" => e.message})
|
||||||
|
status(400)
|
||||||
|
response
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/pipelines/:id" do
|
get "/pipelines/:id" do
|
||||||
|
|
|
@ -9,6 +9,7 @@ module LogStash
|
||||||
|
|
||||||
# return hot threads information
|
# return hot threads information
|
||||||
get "/jvm/hot_threads" do
|
get "/jvm/hot_threads" do
|
||||||
|
begin
|
||||||
top_threads_count = params["threads"] || 3
|
top_threads_count = params["threads"] || 3
|
||||||
ignore_idle_threads = params["ignore_idle_threads"] || true
|
ignore_idle_threads = params["ignore_idle_threads"] || true
|
||||||
options = {
|
options = {
|
||||||
|
@ -17,6 +18,11 @@ module LogStash
|
||||||
}
|
}
|
||||||
|
|
||||||
respond_with(stats_command.hot_threads(options))
|
respond_with(stats_command.hot_threads(options))
|
||||||
|
rescue ArgumentError => e
|
||||||
|
response = respond_with({"error" => e.message})
|
||||||
|
status(400)
|
||||||
|
response
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# return hot threads information
|
# return hot threads information
|
||||||
|
|
|
@ -46,6 +46,17 @@ describe LogStash::Api::Modules::Node do
|
||||||
end
|
end
|
||||||
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
|
context "when asking for human output" do
|
||||||
[
|
[
|
||||||
"/hot_threads?human",
|
"/hot_threads?human",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue