class AwesomeExplain::Subscribers::CommandSubscriber
Attributes
logger[R]
options[RW]
queries[RW]
stats[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/awesome_explain/subscribers/command_subscriber.rb, line 11 def initialize(options = {}) init(options) @logger = ::AwesomeExplain::Config.instance.logger end
Public Instance Methods
clear()
click to toggle source
# File lib/awesome_explain/subscribers/command_subscriber.rb, line 38 def clear init end
failed(event)
click to toggle source
# File lib/awesome_explain/subscribers/command_subscriber.rb, line 28 def failed(event) end
get(metric)
click to toggle source
# File lib/awesome_explain/subscribers/command_subscriber.rb, line 31 def get(metric) case metric when :total_performed_queries total_performed_queries end end
started(event)
click to toggle source
# File lib/awesome_explain/subscribers/command_subscriber.rb, line 16 def started(event) unless COMMAND_NAMES_BLACKLIST.include?(event.command_name) handle_command_start(event) end end
succeeded(event)
click to toggle source
# File lib/awesome_explain/subscribers/command_subscriber.rb, line 22 def succeeded(event) unless COMMAND_NAMES_BLACKLIST.include?(event.command_name) handle_command_success(event) end end
Private Instance Methods
init(options = {})
click to toggle source
# File lib/awesome_explain/subscribers/command_subscriber.rb, line 43 def init(options = {}) @options = options @queries = Hash.new({}) @stats = { total_duration: 0, collections: {}, performed_queries: QUERIES.inject(Hash.new) {|h, q| h[q] = 0; h} } end