Module: Datadog::Tracing::Contrib::MongoDB
- Defined in:
- lib/datadog/tracing/contrib/mongodb/parsers.rb,
lib/datadog/tracing/contrib/mongodb/ext.rb,
lib/datadog/tracing/contrib/mongodb/patcher.rb,
lib/datadog/tracing/contrib/mongodb/integration.rb,
lib/datadog/tracing/contrib/mongodb/subscribers.rb,
lib/datadog/tracing/contrib/mongodb/instrumentation.rb,
lib/datadog/tracing/contrib/mongodb/configuration/settings.rb
Overview
MongoDB module includes classes and functions to instrument MongoDB clients
Defined Under Namespace
Modules: Configuration, Ext, Instrumentation, Patcher Classes: Integration, MongoCommandSubscriber
Constant Summary collapse
- EXCLUDE_KEYS =
[:_id].freeze
- SHOW_KEYS =
[].freeze
- DEFAULT_OPTIONS =
{ exclude: EXCLUDE_KEYS, show: SHOW_KEYS }.freeze
- PLACEHOLDER =
skipped keys are related to command names, since they are already extracted by the query_builder
'?'.freeze
Class Method Summary collapse
- .configuration ⇒ Object
- .quantization_options ⇒ Object
-
.query_builder(command_name, database_name, command) ⇒ Object
returns a formatted and normalized query.
Class Method Details
.configuration ⇒ Object
41 42 43 |
# File 'lib/datadog/tracing/contrib/mongodb/parsers.rb', line 41 def configuration Datadog.configuration.tracing[:mongo] end |
.quantization_options ⇒ Object
37 38 39 |
# File 'lib/datadog/tracing/contrib/mongodb/parsers.rb', line 37 def Contrib::Utils::Quantization::Hash.(DEFAULT_OPTIONS, configuration[:quantize]) end |
.query_builder(command_name, database_name, command) ⇒ Object
returns a formatted and normalized query
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/datadog/tracing/contrib/mongodb/parsers.rb', line 19 def query_builder(command_name, database_name, command) # always exclude the command name = Contrib::Utils::Quantization::Hash.(, exclude: [command_name.to_s]) # quantized statements keys are strings to avoid leaking Symbols in older Rubies # as Symbols are not GC'ed in Rubies prior to 2.2 base_info = Contrib::Utils::Quantization::Hash.format( { 'operation' => command_name, 'database' => database_name, 'collection' => command.values.first }, ) base_info.merge(Contrib::Utils::Quantization::Hash.format(command, )) end |