Module: Datadog::Tracing::Contrib::Component

Defined in:
lib/datadog/tracing/contrib/component.rb

Overview

Initialization hooks for Contrib integrations

Class Method Summary collapse

Class Method Details

.configure(config) ⇒ Object

Invoke all registered callbacks with the given configuration.

Parameters:

  • config (Datadog::Configuration)

    the configuration to pass to callbacks



19
20
21
22
23
24
25
# File 'lib/datadog/tracing/contrib/component.rb', line 19

def configure(config)
  @registry.each do |name, callback|
    callback.call(config)
  rescue => e
    Datadog.logger.warn("Error configuring integration #{name}: #{e}")
  end
end

.register(name, &callback) {|config| ... } ⇒ Object

Register a callback to be invoked when components are reconfigured.

Parameters:

  • name (String)

    the name of the integration

  • callback (Proc)

    the callback to invoke

Yield Parameters:

  • config (Datadog::Configuration)

    the configuration to pass to callbacks



13
14
15
# File 'lib/datadog/tracing/contrib/component.rb', line 13

def register(name, &callback)
  @registry[name] = callback
end