Class: Rack::Bug::RedisPanel
- Defined in:
- lib/rack/bug/panels/redis_panel.rb,
lib/rack/bug/panels/redis_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, #before, #call, #has_content?, #initialize, #panel_app, #render
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::Bug::Panel
Class Method Details
.record(redis_command_args, backtrace, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/rack/bug/panels/redis_panel.rb', line 9 def self.record(redis_command_args, backtrace, &block) return block.call unless Rack::Bug.enabled? start_time = Time.now result = block.call total_time = Time.now - start_time stats.record_call(total_time * 1_000, redis_command_args, backtrace) return result end |
Instance Method Details
#content ⇒ Object
35 36 37 38 39 |
# File 'lib/rack/bug/panels/redis_panel.rb', line 35 def content result = render_template "panels/redis", :stats => self.class.stats self.class.reset return result end |
#heading ⇒ Object
31 32 33 |
# File 'lib/rack/bug/panels/redis_panel.rb', line 31 def heading "Redis: %.2fms (#{self.class.stats.queries.size} calls)" % self.class.stats.time end |
#name ⇒ Object
27 28 29 |
# File 'lib/rack/bug/panels/redis_panel.rb', line 27 def name "redis" end |