Sha256: 2155753e69c5efeaa1a56b4425b1889d7989b4dd595cf457e79d0f9933a61d4b

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

require 'mongo_active_instrumentation/controller_runtime'

module MongoActiveInstrumentation
  class Railtie < Rails::Railtie
    initializer "mongo_active_instrumentation" do |app|
      Mongo::Monitoring::Global.subscribe(
        Mongo::Monitoring::COMMAND,
        MongoActiveInstrumentation::LogSubscriber.new
      )

      # Disable the existing log subscriber
      Mongo::Monitoring::CommandLogSubscriber.class_eval do
        def started(event); end
        def succeeded(event); end
        def failed(event); end
      end

      ActiveSupport.on_load(:action_controller) do
        include MongoActiveInstrumentation::ControllerRuntime
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongo_active_instrumentation-0.1.2 lib/mongo_active_instrumentation/railtie.rb
mongo_active_instrumentation-0.1.1 lib/mongo_active_instrumentation/railtie.rb
mongo_active_instrumentation-0.1.0 lib/mongo_active_instrumentation/railtie.rb