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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTransport

Returns a new instance of Transport.



18
19
20
21
22
23
24
# File 'lib/datadog/core/telemetry/http/transport.rb', line 18

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.



12
13
14
# File 'lib/datadog/core/telemetry/http/transport.rb', line 12

def host
  @host
end

#pathObject (readonly)

Returns the value of attribute path.



12
13
14
# File 'lib/datadog/core/telemetry/http/transport.rb', line 12

def path
  @path
end

#portObject (readonly)

Returns the value of attribute port.



12
13
14
# File 'lib/datadog/core/telemetry/http/transport.rb', line 12

def port
  @port
end

#sslObject (readonly)

Returns the value of attribute ssl.



12
13
14
# File 'lib/datadog/core/telemetry/http/transport.rb', line 12

def ssl
  @ssl
end

Instance Method Details

#request(request_type:, payload:) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/datadog/core/telemetry/http/transport.rb', line 26

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