Method: Datadog::Core::Configuration#configure
- Defined in:
- lib/datadog/core/configuration.rb
#configure {|c| ... } ⇒ Object
Apply global configuration changes to ‘Datadog`. An example of a #configure call:
“‘ Datadog.configure do |c|
c.service = 'my-service'
c.env = 'staging'
# c.diagnostics.debug = true # Enables debug output
end “‘
See Settings for all available options, defaults, and available environment variables for configuration.
Only permits access to global configuration settings; others will raise an error. If you wish to configure a setting for a specific Datadog component (e.g. Tracing), use the corresponding ‘Datadog::COMPONENT.configure` method instead.
Because many configuration changes require restarting internal components, invoking #configure is the only safe way to change ‘Datadog` configuration.
Successive calls to #configure maintain the previous configuration values: configuration is additive between #configure calls.
The yielded configuration ‘c` comes pre-populated from environment variables, if any are applicable.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/datadog/core/configuration.rb', line 83 def configure configuration = self.configuration yield(configuration) safely_synchronize do |write_components| write_components.call( if components? replace_components!(configuration, @components) else build_components(configuration) end ) end configuration end |