class Mongoid::Railties::ControllerRuntime::Collector

The Collector of MongoDB runtime metric, that subscribes to Mongo driver command monitoring. Stores the value within a thread-local variable to provide correct accounting when an application issues MongoDB operations from background threads.

Constants

VARIABLE_NAME

Public Class Methods

reset_runtime() click to toggle source
# File lib/mongoid/railties/controller_runtime.rb, line 79
def self.reset_runtime
  to_now = runtime
  self.runtime = 0
  to_now
end
runtime() click to toggle source
# File lib/mongoid/railties/controller_runtime.rb, line 71
def self.runtime
  Thread.current[VARIABLE_NAME] ||= 0
end
runtime=(value) click to toggle source
# File lib/mongoid/railties/controller_runtime.rb, line 75
def self.runtime= value
  Thread.current[VARIABLE_NAME] = value
end

Public Instance Methods

_completed(e) click to toggle source
# File lib/mongoid/railties/controller_runtime.rb, line 65
def _completed e
  Collector.runtime += e.duration
end
Also aliased as: succeeded, failed
failed(e)
Alias for: _completed
started(_;) click to toggle source
# File lib/mongoid/railties/controller_runtime.rb, line 63
def started _; end
succeeded(e)
Alias for: _completed