Sha256: c3a7892c58b0374b8288e213387bbb9761873e5a3f0fa24c49a4a8dbe7be5ef4

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

# typed: false

require 'datadog/core/configuration/base'
require 'datadog/core/utils/only_once'

module Datadog
  module Tracing
    module Contrib
      module Configuration
        # Common settings for all integrations
        # @public_api
        class Settings
          include Core::Configuration::Base

          DEPRECATION_WARN_ONLY_ONCE = Core::Utils::OnlyOnce.new

          option :analytics_enabled, default: false
          option :analytics_sample_rate, default: 1.0
          option :enabled, default: true
          # TODO: Deprecate per-integration service name when first-class peer service support is added
          # TODO: We don't want to recommend per-integration service naming, but there are no equivalent alternatives today.
          option :service_name

          def configure(options = {})
            self.class.options.dependency_order.each do |name|
              self[name] = options[name] if options.key?(name)
            end

            yield(self) if block_given?
          end

          def [](name)
            respond_to?(name) ? send(name) : get_option(name)
          end

          def []=(name, value)
            respond_to?("#{name}=") ? send("#{name}=", value) : set_option(name, value)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ddtrace-1.2.0 lib/datadog/tracing/contrib/configuration/settings.rb
ddtrace-1.1.0 lib/datadog/tracing/contrib/configuration/settings.rb
ddtrace-1.0.0 lib/datadog/tracing/contrib/configuration/settings.rb
ddtrace-1.0.0.beta2 lib/datadog/tracing/contrib/configuration/settings.rb