module Datadog::Tracing::Contrib::MongoDB

def configuration

def configuration
  Datadog.configuration.tracing[:mongo]
end

def quantization_options

def quantization_options
  Contrib::Utils::Quantization::Hash.merge_options(DEFAULT_OPTIONS, configuration[:quantize])
end

def query_builder(command_name, database_name, command)

returns a formatted and normalized query
def query_builder(command_name, database_name, command)
  # always exclude the command name
  options = Contrib::Utils::Quantization::Hash.merge_options(quantization_options, 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
    },
    options
  )
  base_info.merge(Contrib::Utils::Quantization::Hash.format(command, options))
end