Class: Rack::Insight::MongoPanel
- Defined in:
- lib/rack/insight/panels/mongo_panel.rb,
lib/rack/insight/panels/mongo_panel/stats.rb
Defined Under Namespace
Classes: Stats
Instance Attribute Summary
Attributes inherited from Panel
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Panel
#after, #after_detect, #before, #bool_prop, #call, #camelized_name, #content_for_request, current_panel_file, excluded, file_index, from_file, #handle_error_for, #has_content?, #has_custom_probes?, has_table, #has_table?, #heading_for_request, inherited, #initialize, #inspect, #is_magic?, #is_probing?, #name, #panel_app, panel_exclusion, panel_mappings, #render, set_sub_class_template_root, #underscored_name
Methods included from Database::EigenClient
Methods included from Instrumentation::EigenClient
Methods included from Logging
Methods included from Instrumentation::Client
#after_detect, #before_detect, #probe, #request_finish, #request_start
Methods included from Database::RequestDataClient
#count, #key_sql_template, #retrieve, #store, #table_length, #table_setup
Methods included from Render
#compile, #compile!, #compiled_source, #method_name, #method_name_without_locals, #render_template, #signed_params
Constructor Details
This class inherits a constructor from Rack::Insight::Panel
Class Method Details
.record(command, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/rack/insight/panels/mongo_panel.rb', line 9 def self.record(command, &block) return block.call unless Rack::Insight.enabled? start_time = Time.now result = block.call total_time = Time.now - start_time stats.record_call(total_time * 1_000, command) return result end |
Instance Method Details
#content ⇒ Object
31 32 33 34 35 |
# File 'lib/rack/insight/panels/mongo_panel.rb', line 31 def content result = render_template "panels/mongo", :stats => self.class.stats self.class.reset return result end |
#heading ⇒ Object
27 28 29 |
# File 'lib/rack/insight/panels/mongo_panel.rb', line 27 def heading "Mongo: %.2fms (#{self.class.stats.queries.size} calls)" % self.class.stats.time end |