Module: Datadog::Tracing::Contrib::MongoDB::Patcher

Includes:
Patcher
Defined in:
lib/datadog/tracing/contrib/mongodb/patcher.rb

Overview

Patcher enables patching of ‘mongo’ module.

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.add_mongo_monitoringObject



26
27
28
29
# File 'lib/datadog/tracing/contrib/mongodb/patcher.rb', line 26

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

.patchObject



21
22
23
24
# File 'lib/datadog/tracing/contrib/mongodb/patcher.rb', line 21

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

.target_versionObject



17
18
19
# File 'lib/datadog/tracing/contrib/mongodb/patcher.rb', line 17

def target_version
  Integration.version
end