Class: Datadog::Contrib::Configuration::Settings

Inherits:
Object
  • Object
show all
Includes:
Datadog::Configuration::Base, Patcher
Defined in:
lib/ddtrace/contrib/configuration/settings.rb

Overview

Common settings for all integrations

Constant Summary collapse

DEPRECATION_WARNING =
%(
Explicitly providing a tracer instance is DEPRECATED.
It's recommended to not provide an explicit tracer instance
and let Datadog::Contrib::Configuration::Settings resolve
the correct tracer internally.
).freeze

Instance Method Summary collapse

Methods included from Patcher

included

Methods included from Patcher::CommonMethods

#do_once, #done?, #without_warnings

Methods included from Datadog::Configuration::Base

included

Instance Method Details

#[](name) ⇒ Object



29
30
31
# File 'lib/ddtrace/contrib/configuration/settings.rb', line 29

def [](name)
  respond_to?(name) ? send(name) : get_option(name)
end

#[]=(name, value) ⇒ Object



33
34
35
# File 'lib/ddtrace/contrib/configuration/settings.rb', line 33

def []=(name, value)
  respond_to?("#{name}=") ? send("#{name}=", value) : set_option(name, value)
end

#configure(options = {}) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



21
22
23
24
25
26
27
# File 'lib/ddtrace/contrib/configuration/settings.rb', line 21

def configure(options = {})
  self.class.options.dependency_order.each do |name|
    self[name] = options[name] if options.key?(name)
  end

  yield(self) if block_given?
end

#log_deprecation_warning(method_name) ⇒ Object



46
47
48
49
50
# File 'lib/ddtrace/contrib/configuration/settings.rb', line 46

def log_deprecation_warning(method_name)
  do_once(method_name) do
    Datadog.logger.warn("#{method_name}:#{DEPRECATION_WARNING}:#{caller.join("\n")}")
  end
end