Sha256: e96b350446596eb10b003edfb6412dc517f1697de2d67d42841497e2d541124f

Contents?: true

Size: 823 Bytes

Versions: 5

Compression:

Stored size: 823 Bytes

Contents

# typed: false
require 'ddtrace/contrib/patcher'
require 'ddtrace/contrib/mongodb/ext'
require 'ddtrace/contrib/mongodb/instrumentation'

module Datadog
  module Contrib
    module MongoDB
      # Patcher enables patching of 'mongo' module.
      module Patcher
        include Contrib::Patcher

        module_function

        def target_version
          Integration.version
        end

        def patch
          ::Mongo::Address.include(Instrumentation::Address)
          ::Mongo::Client.include(Instrumentation::Client)
          add_mongo_monitoring
        end

        def add_mongo_monitoring
          # Subscribe to all COMMAND queries with our subscriber class
          ::Mongo::Monitoring::Global.subscribe(::Mongo::Monitoring::COMMAND, MongoCommandSubscriber.new)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ddtrace-0.54.2 lib/ddtrace/contrib/mongodb/patcher.rb
ddtrace-0.54.1 lib/ddtrace/contrib/mongodb/patcher.rb
ddtrace-0.54.0 lib/ddtrace/contrib/mongodb/patcher.rb
ddtrace-0.53.0 lib/ddtrace/contrib/mongodb/patcher.rb
ddtrace-0.52.0 lib/ddtrace/contrib/mongodb/patcher.rb