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`.
Class Method Details
.included(base) ⇒ Object
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 142 143 |
# File 'lib/datadog/tracing/contrib/extensions.rb', line 113 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.
185 186 187 188 |
# File 'lib/datadog/tracing/contrib/extensions.rb', line 185 def [](integration_name, key = :default) integration = fetch_integration(integration_name) integration.resolve(key) unless integration.nil? end |
#ignore_integration_load_errors=(value) ⇒ Object
217 218 219 |
# File 'lib/datadog/tracing/contrib/extensions.rb', line 217 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.
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/datadog/tracing/contrib/extensions.rb', line 157 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 |