class Datadog::Configuration::Settings

Global configuration settings for the trace library. rubocop:disable Metrics/ClassLength

Public Instance Methods

logger=(logger) click to toggle source
# File lib/ddtrace/configuration/settings.rb, line 101
def logger=(logger)
  get_option(:logger).instance = logger
end
runtime_metrics(options = nil) click to toggle source

Backwards compatibility for configuring runtime metrics e.g. `c.runtime_metrics enabled: true`

# File lib/ddtrace/configuration/settings.rb, line 121
def runtime_metrics(options = nil)
  settings = get_option(:runtime_metrics)
  return settings if options.nil?

  # If options were provided (old style) then raise warnings and apply them:
  # TODO: Raise deprecation warning
  settings.enabled = options[:enabled] if options.key?(:enabled)
  settings.statsd = options[:statsd] if options.key?(:statsd)
  settings
end
tracer(options = nil) click to toggle source

Backwards compatibility for configuring tracer e.g. `c.tracer debug: true`

# File lib/ddtrace/configuration/settings.rb, line 225
def tracer(options = nil)
  settings = get_option(:tracer)
  return settings if options.nil?

  # If options were provided (old style) then raise warnings and apply them:
  options = options.dup

  if options.key?(:log)
    # TODO: Raise deprecation warning
    get_option(:logger).instance = options.delete(:log)
  end

  if options.key?(:tags)
    # TODO: Raise deprecation warning
    set_option(:tags, options.delete(:tags))
  end

  if options.key?(:env)
    # TODO: Raise deprecation warning
    set_option(:env, options.delete(:env))
  end

  if options.key?(:debug)
    # TODO: Raise deprecation warning
    get_option(:diagnostics).debug = options.delete(:debug)
  end

  if options.key?(:partial_flush)
    # TODO: Raise deprecation warning
    settings.partial_flush.enabled = options.delete(:partial_flush)
  end

  if options.key?(:min_spans_before_partial_flush)
    # TODO: Raise deprecation warning
    settings.partial_flush.min_spans_threshold = options.delete(:min_spans_before_partial_flush)
  end

  # Forward remaining options to settings
  options.each do |key, value|
    setter = :"#{key}="
    settings.send(setter, value) if settings.respond_to?(setter)
  end
end
tracer=(tracer) click to toggle source
# File lib/ddtrace/configuration/settings.rb, line 269
def tracer=(tracer)
  get_option(:tracer).instance = tracer
end