Sha256: f136d3ee446ad398c53d15a85d590e2583d4eb14fd0cdf439bbf95304f48f470
Contents?: true
Size: 1022 Bytes
Versions: 17
Compression:
Stored size: 1022 Bytes
Contents
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 patched? done?(:mongo) end def patch do_once(:mongo) do begin ::Mongo::Address.send(:include, Instrumentation::Address) ::Mongo::Client.send(:include, Instrumentation::Client) add_mongo_monitoring rescue StandardError => e Datadog::Tracer.log.error("Unable to apply MongoDB integration: #{e}") end end 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
17 entries across 17 versions & 2 rubygems