Class: Datadog::Core::Telemetry::Http::Transport

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/core/telemetry/http/transport.rb

Overview

Class to send telemetry data to Telemetry API Currently only supports the HTTP protocol.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTransport

Returns a new instance of Transport.



22
23
24
25
26
27
28
# File 'lib/datadog/core/telemetry/http/transport.rb', line 22

def initialize
  agent_settings = Configuration::AgentSettingsResolver.call(Datadog.configuration)
  @host = agent_settings.hostname
  @port = agent_settings.port
  @ssl = false
  @path = Http::Ext::AGENT_ENDPOINT
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



16
17
18
# File 'lib/datadog/core/telemetry/http/transport.rb', line 16

def host
  @host
end

#pathObject (readonly)

Returns the value of attribute path.



16
17
18
# File 'lib/datadog/core/telemetry/http/transport.rb', line 16

def path
  @path
end

#portObject (readonly)

Returns the value of attribute port.



16
17
18
# File 'lib/datadog/core/telemetry/http/transport.rb', line 16

def port
  @port
end

#sslObject (readonly)

Returns the value of attribute ssl.



16
17
18
# File 'lib/datadog/core/telemetry/http/transport.rb', line 16

def ssl
  @ssl
end

Instance Method Details

#request(request_type:, payload:) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/datadog/core/telemetry/http/transport.rb', line 30

def request(request_type:, payload:)
  env = Http::Env.new
  env.path = @path
  env.body = payload
  env.headers = headers(request_type: request_type)
  adapter.post(env)
end