fix human parameter processing

Fixes #5621
This commit is contained in:
Pere Urbon-Bayes 2016-07-12 12:24:12 +02:00
parent f5cf122f3b
commit d54c66a8dd
3 changed files with 6 additions and 7 deletions

View file

@ -7,11 +7,10 @@ module LogStash::Api::AppHelpers
as = options.fetch(:as, :json)
pretty = params.has_key?("pretty")
unless options.include?(:exclude_default_metadata)
data = default_metadata.merge(data)
end
if as == :json
unless options.include?(:exclude_default_metadata)
data = default_metadata.merge(data)
end
content_type "application/json"
LogStash::Json.dump(data, {:pretty => pretty})
else

View file

@ -62,7 +62,7 @@ module LogStash
end
def to_s
hash = to_hash
hash = to_hash[:hot_threads]
report = "#{I18n.t("logstash.web_api.hot_threads.title", :hostname => hash[:hostname], :time => hash[:time], :top_count => @thread_dump.top_count )} \n"
report << '=' * 80
report << "\n"
@ -98,7 +98,7 @@ module LogStash
thread[:traces] = traces unless traces.empty?
hash[:threads] << thread
end
hash
{ :hot_threads => hash }
end
def cpu_time_as_percent(hash)

View file

@ -35,7 +35,7 @@ module LogStash
options[:threads] = params["threads"].to_i if params.has_key?("threads")
as = options[:human] ? :string : :json
respond_with({:hot_threads => node.hot_threads(options)}, {:as => as})
respond_with(node.hot_threads(options), {:as => as})
end
end
end