mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Small improvements for the hot_threads api
- Fix the typo in the human format - Make sure we use the I18n string for the output Fixes #5766
This commit is contained in:
parent
226c51ca0e
commit
6c88649afe
3 changed files with 5 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class HotThreadsReport
|
||||
STRING_SEPARATOR_LENGHT = 80.freeze
|
||||
HOT_THREADS_STACK_TRACES_SIZE_DEFAULT = 10.freeze
|
||||
|
||||
def initialize(cmd, options)
|
||||
|
@ -13,19 +14,16 @@ class HotThreadsReport
|
|||
def to_s
|
||||
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 << '=' * STRING_SEPARATOR_LENGHT
|
||||
report << "\n"
|
||||
hash[:threads].each do |thread|
|
||||
thread_report = ""
|
||||
thread_report = "#{I18n.t("logstash.web_api.
|
||||
hot_threads.thread_title", :percent_of_cpu_time => thread[:percent_of_cpu_time], :thread_state => thread[:state], :thread_name => thread[:name])} \n"
|
||||
thread_report = "#{thread[:percent_of_cpu_time]} % of of cpu usage by #{thread[:state]} thread named '#{thread[:name]}'\n"
|
||||
thread_report = "#{I18n.t("logstash.web_api.hot_threads.thread_title", :percent_of_cpu_time => thread[:percent_of_cpu_time], :thread_state => thread[:state], :thread_name => thread[:name])} \n"
|
||||
thread_report << "#{thread[:path]}\n" if thread[:path]
|
||||
thread[:traces].each do |trace|
|
||||
thread_report << "\t#{trace}\n"
|
||||
end
|
||||
report << thread_report
|
||||
report << '-' * 80
|
||||
report << '-' * STRING_SEPARATOR_LENGHT
|
||||
report << "\n"
|
||||
end
|
||||
report
|
||||
|
@ -57,5 +55,4 @@ class HotThreadsReport
|
|||
def cpu_time(hash)
|
||||
hash["cpu.time"] / 1000000.0
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -26,7 +26,6 @@ module LogStash
|
|||
selected_fields = extract_fields(params["filter"].to_s.strip)
|
||||
respond_with node.all(selected_fields)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -78,7 +78,7 @@ en:
|
|||
::: {%{hostname}}
|
||||
Hot threads at %{time}, busiestThreads=%{top_count}:
|
||||
thread_title: |-
|
||||
%{percent_of_cpu_time} % of cpu usage by %{thread_state} thread named '%{thread_name}'
|
||||
%{percent_of_cpu_time} % of cpu usage, state: %{thread_state}, thread name: '%{thread_name}'
|
||||
runner:
|
||||
short-help: |-
|
||||
usage:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue