Module: Datadog::Tracing::Remote

Defined in:
lib/datadog/tracing/remote.rb

Overview

Remote configuration declaration

Defined Under Namespace

Classes: ReadError

Constant Summary collapse

PRODUCT =
'APM_TRACING'

Class Method Summary collapse

Class Method Details

.capabilitiesObject



19
20
21
# File 'lib/datadog/tracing/remote.rb', line 19

def capabilities
  [] # No capabilities advertised
end

.process_config(config, content) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/datadog/tracing/remote.rb', line 23

def process_config(config, content)
  lib_config = config['lib_config']

  env_vars = Datadog::Tracing::Configuration::Dynamic::OPTIONS.map do |name, env_var, option|
    value = lib_config[name]

    # Guard for RBS/Steep
    raise "option is a #{option.class}, expected Option" unless option.is_a?(Configuration::Dynamic::Option)

    option.call(value)

    [env_var, value]
  end

  content.applied

  Datadog.send(:components).telemetry.client_configuration_change!(env_vars)
rescue => e
  content.errored("#{e.class.name} #{e.message}: #{Array(e.backtrace).join("\n")}")
end

.productsObject



15
16
17
# File 'lib/datadog/tracing/remote.rb', line 15

def products
  [PRODUCT]
end

.receiver(products = [PRODUCT], &block) ⇒ Object



59
60
61
62
# File 'lib/datadog/tracing/remote.rb', line 59

def receiver(products = [PRODUCT], &block)
  matcher = Core::Remote::Dispatcher::Matcher::Product.new(products)
  [Core::Remote::Dispatcher::Receiver.new(matcher, &block)]
end

.receiversObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/datadog/tracing/remote.rb', line 44

def receivers
  receiver do |repository, _changes|
    # DEV: Filter our by product. Given it will be very common
    # DEV: we can filter this out before we receive the data in this method.
    # DEV: Apply this refactor to AppSec as well if implemented.
    repository.contents.map do |content|
      case content.path.product
      when PRODUCT
        config = parse_content(content)
        process_config(config, content)
      end
    end
  end
end