Class: Datadog::Tracing::Configuration::Dynamic::SimpleOption
- Defined in:
- lib/datadog/tracing/configuration/dynamic/option.rb
Overview
A dynamic configuration option that can directly mapped to a ‘Datadog.configuration` option and changing such option is the only requirement to apply the configuration locally.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Option
Instance Method Summary collapse
-
#call(value) ⇒ Object
Reconfigures the provided option, setting its value to ‘value`.
-
#initialize(name, env_var, setting_key) ⇒ SimpleOption
constructor
DEV: ‘Datadog.configuration` cannot be an argument default value because DEV: it is dynamic.
Constructor Details
#initialize(name, env_var, setting_key) ⇒ SimpleOption
DEV: ‘Datadog.configuration` cannot be an argument default value because DEV: it is dynamic. Also, it is not yet declared when this method is parsed by Ruby.
35 36 37 38 |
# File 'lib/datadog/tracing/configuration/dynamic/option.rb', line 35 def initialize(name, env_var, setting_key) super(name, env_var) @setting_key = setting_key end |
Instance Method Details
#call(value) ⇒ Object
Reconfigures the provided option, setting its value to ‘value`.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/datadog/tracing/configuration/dynamic/option.rb', line 43 def call(value) Datadog.logger.debug { "Reconfigured tracer option `#{@setting_key}` with value `#{value}`" } if value.nil? # Restore the local configuration value configuration_object.unset_option( @setting_key, precedence: Core::Configuration::Option::Precedence::REMOTE_CONFIGURATION ) else configuration_object.set_option( @setting_key, value, precedence: Core::Configuration::Option::Precedence::REMOTE_CONFIGURATION ) end end |