Class: Datadog::Core::Configuration::AgentSettingsResolver::TransportOptionsResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/core/configuration/agent_settings_resolver.rb

Overview

Used to extract information from the transport_options proc (see #transport_options above)

Instance Method Summary collapse

Constructor Details

#initialize(transport_options) ⇒ TransportOptionsResolver

Returns a new instance of TransportOptionsResolver.



382
383
384
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 382

def initialize(transport_options)
  @transport_options = transport_options
end

Instance Method Details

#adapter(kind_or_custom_adapter, *args, **kwargs) ⇒ Object



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 386

def adapter(kind_or_custom_adapter, *args, **kwargs)
  case kind_or_custom_adapter
  when Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER
    @transport_options.adapter = Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER
    @transport_options.hostname = args[0] || kwargs[:hostname]
    @transport_options.port = args[1] || kwargs[:port]
    @transport_options.timeout_seconds = kwargs[:timeout]
    @transport_options.ssl = kwargs[:ssl]
  when Datadog::Core::Configuration::Ext::Agent::UnixSocket::ADAPTER
    @transport_options.adapter = Datadog::Core::Configuration::Ext::Agent::UnixSocket::ADAPTER
    @transport_options.uds_path = args[0] || kwargs[:uds_path]
  end

  nil
end