Module: Datadog::DI::Transport::HTTP Private

Defined in:
lib/datadog/di/transport/http.rb,
lib/datadog/di/transport/http/input.rb,
lib/datadog/di/transport/http/diagnostics.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Namespace for HTTP transport components

Defined Under Namespace

Modules: Diagnostics, Input

Constant Summary collapse

DIAGNOSTICS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Diagnostics::API::Endpoint.new(
  '/debugger/v1/diagnostics',
  Core::Encoding::JSONEncoder,
)
INPUT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Input::API::Endpoint.new(
  '/debugger/v2/input',
  Core::Encoding::JSONEncoder,
)
LEGACY_INPUT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Input::API::Endpoint.new(
  # We used to use /debugger/v1/input, but now input
  # payloads should be going to the diagnostics endpoint
  # which I gather performs data redaction.
  '/debugger/v1/diagnostics',
  Core::Encoding::JSONEncoder,
)

Class Method Summary collapse

Class Method Details

.diagnostics(agent_settings:, logger:, headers: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds a new Transport::HTTP::Client with default settings Pass a block to override any settings.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/datadog/di/transport/http.rb', line 33

def self.diagnostics(
  agent_settings:,
  logger:,
  headers: nil
)
  Core::Transport::HTTP.build(
    logger: logger,
    agent_settings: agent_settings,
    headers: headers,
  ) do |transport|
    transport.api 'diagnostics', DIAGNOSTICS

    # Call block to apply any customization, if provided
    yield(transport) if block_given?
  end.to_transport(DI::Transport::Diagnostics::Transport)
end

.input(agent_settings:, logger:, headers: nil, telemetry: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds a new Transport::HTTP::Client with default settings Pass a block to override any settings.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/datadog/di/transport/http.rb', line 52

def self.input(
  agent_settings:,
  logger:,
  headers: nil,
  telemetry: nil
)
  builder = Core::Transport::HTTP.build(
    logger: logger,
    agent_settings: agent_settings,
    headers: headers,
  ) do |transport|
    transport.api 'input', INPUT, fallback: 'legacy_input', default: true
    transport.api 'legacy_input', LEGACY_INPUT

    # Call block to apply any customization, if provided
    yield(transport) if block_given?
  end

  # Create transport with telemetry
  DI::Transport::Input::Transport.new(
    builder.to_api_instances,
    builder.default_api,
    logger: logger,
    telemetry: telemetry
  )
end