Module: Datadog::Tracing::Contrib::Extensions::Configuration::Settings
- Defined in:
- lib/datadog/tracing/contrib/extensions.rb
Overview
Extensions for Datadog::Core::Configuration::Settings
Constant Summary collapse
- InvalidIntegrationError =
Class.new(StandardError)
Class Method Summary collapse
Instance Method Summary collapse
-
#[](integration_name, key = :default) ⇒ Datadog::Tracing::Contrib::Configuration::Settings
For the provided ‘integration_name`, resolves a matching configuration for the provided integration from an integration-specific `key`.
- #ignore_integration_load_errors=(value) ⇒ Object
-
#instrument(integration_name, options = {}, &block) ⇒ Datadog::Tracing::Contrib::Integration
Applies instrumentation for the provided ‘integration_name`.
- #use(integration_name, options = {}, &block) ⇒ Object
Class Method Details
.included(base) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/datadog/tracing/contrib/extensions.rb', line 111 def self.included(base) base.class_eval do settings :contrib do # Key-value map for explicitly re-mapping peer.service values # # @default `DD_TRACE_PEER_SERVICE_MAPPING` environment variable converted to hash # @return [Hash] option :peer_service_mapping do |o| o.env Tracing::Configuration::Ext::SpanAttributeSchema::ENV_PEER_SERVICE_MAPPING o.type :hash o.default({}) end # Global service name behavior settings :global_default_service_name do # Overrides default service name to global service name # # Allows for usage of v1 service name changes without # being forced to update schema versions # # @default `DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED` environment variable, otherwise `false` # @return [Boolean] option :enabled do |o| o.env Tracing::Configuration::Ext::SpanAttributeSchema::ENV_GLOBAL_DEFAULT_SERVICE_NAME_ENABLED o.type :bool o.default false end end end end end |
Instance Method Details
#[](integration_name, key = :default) ⇒ Datadog::Tracing::Contrib::Configuration::Settings
For the provided ‘integration_name`, resolves a matching configuration for the provided integration from an integration-specific `key`.
How the matching is performed is integration-specific.
190 191 192 193 |
# File 'lib/datadog/tracing/contrib/extensions.rb', line 190 def [](integration_name, key = :default) integration = fetch_integration(integration_name) integration.resolve(key) unless integration.nil? end |
#ignore_integration_load_errors=(value) ⇒ Object
222 223 224 |
# File 'lib/datadog/tracing/contrib/extensions.rb', line 222 def ignore_integration_load_errors=(value) @ignore_integration_load_errors = value end |
#instrument(integration_name, options = {}, &block) ⇒ Datadog::Tracing::Contrib::Integration
Applies instrumentation for the provided ‘integration_name`.
Options may be provided, that are specific to that instrumentation. See the instrumentation’s settings file for a list of available options.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/datadog/tracing/contrib/extensions.rb', line 155 def instrument(integration_name, = {}, &block) integration = fetch_integration(integration_name) unless integration.nil? || !integration.default_configuration.enabled configuration_name = [:describes] || :default = .reject { |k, _v| k == :describes } integration.configure(configuration_name, , &block) instrumented_integrations[integration_name] = integration # Add to activation list integrations_pending_activation << integration end integration end |
#use(integration_name, options = {}, &block) ⇒ Object
171 172 173 174 175 176 |
# File 'lib/datadog/tracing/contrib/extensions.rb', line 171 def use(integration_name, = {}, &block) Core.log_deprecation do 'Configuration with `use` has been deprecated, use `instrument` instead.' end instrument(integration_name, , &block) end |