mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
parent
f5cf122f3b
commit
d54c66a8dd
3 changed files with 6 additions and 7 deletions
|
@ -7,11 +7,10 @@ module LogStash::Api::AppHelpers
|
||||||
as = options.fetch(:as, :json)
|
as = options.fetch(:as, :json)
|
||||||
pretty = params.has_key?("pretty")
|
pretty = params.has_key?("pretty")
|
||||||
|
|
||||||
unless options.include?(:exclude_default_metadata)
|
|
||||||
data = default_metadata.merge(data)
|
|
||||||
end
|
|
||||||
|
|
||||||
if as == :json
|
if as == :json
|
||||||
|
unless options.include?(:exclude_default_metadata)
|
||||||
|
data = default_metadata.merge(data)
|
||||||
|
end
|
||||||
content_type "application/json"
|
content_type "application/json"
|
||||||
LogStash::Json.dump(data, {:pretty => pretty})
|
LogStash::Json.dump(data, {:pretty => pretty})
|
||||||
else
|
else
|
||||||
|
|
|
@ -62,7 +62,7 @@ module LogStash
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
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 = "#{I18n.t("logstash.web_api.hot_threads.title", :hostname => hash[:hostname], :time => hash[:time], :top_count => @thread_dump.top_count )} \n"
|
||||||
report << '=' * 80
|
report << '=' * 80
|
||||||
report << "\n"
|
report << "\n"
|
||||||
|
@ -98,7 +98,7 @@ module LogStash
|
||||||
thread[:traces] = traces unless traces.empty?
|
thread[:traces] = traces unless traces.empty?
|
||||||
hash[:threads] << thread
|
hash[:threads] << thread
|
||||||
end
|
end
|
||||||
hash
|
{ :hot_threads => hash }
|
||||||
end
|
end
|
||||||
|
|
||||||
def cpu_time_as_percent(hash)
|
def cpu_time_as_percent(hash)
|
||||||
|
|
|
@ -35,7 +35,7 @@ module LogStash
|
||||||
options[:threads] = params["threads"].to_i if params.has_key?("threads")
|
options[:threads] = params["threads"].to_i if params.has_key?("threads")
|
||||||
|
|
||||||
as = options[:human] ? :string : :json
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue