Class: Munin::RailsViewRenderTime
- Inherits:
-
RailsPlugin
- Object
- RequestLogAnalyzerPlugin
- RailsPlugin
- Munin::RailsViewRenderTime
- Defined in:
- lib/munin/plugins/rails_view_render_time.rb
Instance Attribute Summary
Attributes inherited from RailsPlugin
#after_time, #floor_time, #interval, #log_file, #log_format, #number_of_lines, #request_log_analyzer, #temp_file_name, #temp_folder, #temp_prefix
Attributes inherited from RequestLogAnalyzerPlugin
#debug, #environment, #graph_category, #passenger_memory_stats, #passenger_status
Instance Method Summary collapse
- #config ⇒ Object
-
#run ⇒ Object
Gather information.
Methods inherited from RailsPlugin
#ensure_configuration, #ensure_log_file, #fetch_or_create_yaml_file, #get_request_log_analyzer_file, #handle_arguments, #parse_request_log_analyzer_data
Methods inherited from RequestLogAnalyzerPlugin
#autoconf, #ensure_configuration, #handle_arguments, #initialize, #require_command, #require_gem, #require_passenger_gem, #require_passenger_memory_stats, #require_passenger_status, #require_request_log_analyzer_gem, #require_tail_command, #require_yaml_gem, #run_command
Constructor Details
This class inherits a constructor from Munin::RequestLogAnalyzerPlugin
Instance Method Details
#config ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/munin/plugins/rails_view_render_time.rb', line 5 def config puts "graph_category \#{graph_category}\ngraph_title View render times\ngraph_vlabel Seconds\ngraph_args --base 1000 -l 0\ngraph_info The minimum, maximum and average view render times - railsdoctors.com\n\nmin.label min\nmax.label max\naverage.label avg\n" exit 0 end |
#run ⇒ Object
Gather information
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/munin/plugins/rails_view_render_time.rb', line 21 def run ensure_log_file # Initialize values max_value = 0 min_value = 1.0/0.0 cumulative = 0 hits = 0 rla = parse_request_log_analyzer_data if rla && rla["View rendering time"] rla["View rendering time"].each do |item| max_value = item[1][:max] if item[1][:max] > max_value min_value = item[1][:min] if item[1][:min] < min_value hits += item[1][:hits] cumulative += item[1][:sum] end else hits = 1 min_value = 0 end puts "max.value #{max_value}" puts "min.value #{min_value}" puts "average.value #{cumulative / hits.to_f}" end |