Module: Datadog::Configuration

Extended by:
Forwardable
Includes:
Kernel
Included in:
Datadog
Defined in:
lib/ddtrace/configuration.rb,
lib/ddtrace/configuration/base.rb,
lib/ddtrace/configuration/option.rb,
lib/ddtrace/configuration/options.rb,
lib/ddtrace/configuration/settings.rb,
lib/ddtrace/configuration/pin_setup.rb,
lib/ddtrace/configuration/components.rb,
lib/ddtrace/configuration/option_set.rb,
lib/ddtrace/configuration/option_definition.rb,
lib/ddtrace/configuration/dependency_resolver.rb,
lib/ddtrace/configuration/option_definition_set.rb,
lib/ddtrace/configuration/agent_settings_resolver.rb

Overview

Configuration provides a unique access point for configurations

Defined Under Namespace

Modules: Base, Options Classes: AgentSettingsResolver, Components, DependencyResolver, Option, OptionDefinition, OptionDefinitionSet, OptionSet, PinSetup, Settings

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configurationObject



42
43
44
# File 'lib/ddtrace/configuration.rb', line 42

def configuration
  @configuration ||= Settings.new
end

Instance Method Details

#configure(target = configuration, opts = {}) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ddtrace/configuration.rb', line 46

def configure(target = configuration, opts = {})
  if target.is_a?(Settings)
    yield(target) if block_given?

    safely_synchronize do |write_components|
      write_components.call(
        if components?
          replace_components!(target, @components)
        else
          build_components(target)
        end
      )
    end

    target
  else
    PinSetup.new(target, opts).call
  end
end

#loggerObject



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/ddtrace/configuration.rb', line 73

def logger
  # avoid initializing components if they didn't already exist
  current_components = components(allow_initialization: false)

  if current_components
    @temp_logger = nil
    current_components.logger
  else
    logger_without_components
  end
end

#shutdown!Object

Gracefully shuts down all components.

Components will still respond to method calls as usual, but might not internally perform their work after shutdown.

This avoids errors being raised across the host application during shutdown, while allowing for graceful decommission of resources.

Components won't be automatically reinitialized after a shutdown.



94
95
96
97
98
# File 'lib/ddtrace/configuration.rb', line 94

def shutdown!
  safely_synchronize do
    @components.shutdown! if components?
  end
end