Module: Datadog::Tracing::Transport::HTTP
- Defined in:
- lib/datadog/tracing/transport/http.rb,
lib/datadog/tracing/transport/http/api.rb,
lib/datadog/tracing/transport/http/client.rb,
lib/datadog/tracing/transport/http/traces.rb,
lib/datadog/tracing/transport/http/builder.rb,
lib/datadog/tracing/transport/http/api/spec.rb,
lib/datadog/tracing/transport/http/statistics.rb,
lib/datadog/tracing/transport/http/api/instance.rb
Overview
Namespace for HTTP transport components
Defined Under Namespace
Modules: API, Statistics, Traces Classes: Builder, Client
Constant Summary collapse
- DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS =
NOTE: Due to… legacy reasons… This class likes having a default ‘AgentSettings` instance to fall back to. Because we generate this instance with an empty instance of `Settings`, the resulting `AgentSettings` below represents only settings specified via environment variables + the usual defaults.
DO NOT USE THIS IN NEW CODE, as it ignores any settings specified by users via ‘Datadog.configure`.
Datadog::Core::Configuration::AgentSettingsResolver.call( Datadog::Core::Configuration::Settings.new, logger: nil, )
Class Method Summary collapse
-
.default(agent_settings: DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS, **options) ⇒ Object
Builds a new Transport::HTTP::Client with default settings Pass a block to override any settings.
- .default_adapter ⇒ Object
- .default_headers ⇒ Object
- .default_hostname(logger: Datadog.logger) ⇒ Object
- .default_port(logger: Datadog.logger) ⇒ Object
- .default_url(logger: Datadog.logger) ⇒ Object
-
.new(&block) ⇒ Object
Builds a new Transport::HTTP::Client.
Class Method Details
.default(agent_settings: DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS, **options) ⇒ Object
Builds a new Transport::HTTP::Client with default settings Pass a block to override any settings.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/datadog/tracing/transport/http.rb', line 39 def default( agent_settings: DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS, ** ) new do |transport| transport.adapter(agent_settings) transport.headers default_headers apis = API.defaults transport.api API::V4, apis[API::V4], fallback: API::V3, default: true transport.api API::V3, apis[API::V3] # Apply any settings given by options unless .empty? transport.default_api = [:api_version] if .key?(:api_version) transport.headers [:headers] if .key?(:headers) end if agent_settings.deprecated_for_removal_transport_configuration_proc agent_settings.deprecated_for_removal_transport_configuration_proc.call(transport) end # Call block to apply any customization, if provided yield(transport) if block_given? end end |
.default_adapter ⇒ Object
84 85 86 |
# File 'lib/datadog/tracing/transport/http.rb', line 84 def default_adapter Datadog::Core::Transport::Ext::HTTP::ADAPTER end |
.default_headers ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/datadog/tracing/transport/http.rb', line 67 def default_headers { Datadog::Core::Transport::Ext::HTTP::HEADER_CLIENT_COMPUTED_TOP_LEVEL => '1', Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG => Datadog::Core::Environment::Ext::LANG, Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_VERSION => Datadog::Core::Environment::Ext::LANG_VERSION, Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_INTERPRETER => Datadog::Core::Environment::Ext::LANG_INTERPRETER, Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_INTERPRETER_VENDOR => Core::Environment::Ext::LANG_ENGINE, Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION => Datadog::Core::Environment::Ext::TRACER_VERSION }.tap do |headers| # Add container ID, if present. container_id = Datadog::Core::Environment::Container.container_id headers[Datadog::Core::Transport::Ext::HTTP::HEADER_CONTAINER_ID] = container_id unless container_id.nil? end end |
.default_hostname(logger: Datadog.logger) ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/datadog/tracing/transport/http.rb', line 88 def default_hostname(logger: Datadog.logger) logger.warn( 'Deprecated for removal: Using #default_hostname for configuration is deprecated and will ' \ 'be removed on a future ddtrace release.' ) DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS.hostname end |
.default_port(logger: Datadog.logger) ⇒ Object
97 98 99 100 101 102 103 104 |
# File 'lib/datadog/tracing/transport/http.rb', line 97 def default_port(logger: Datadog.logger) logger.warn( 'Deprecated for removal: Using #default_hostname for configuration is deprecated and will ' \ 'be removed on a future ddtrace release.' ) DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS.port end |
.default_url(logger: Datadog.logger) ⇒ Object
106 107 108 109 110 111 112 113 |
# File 'lib/datadog/tracing/transport/http.rb', line 106 def default_url(logger: Datadog.logger) logger.warn( 'Deprecated for removal: Using #default_url for configuration is deprecated and will ' \ 'be removed on a future ddtrace release.' ) nil end |
.new(&block) ⇒ Object
Builds a new Transport::HTTP::Client
33 34 35 |
# File 'lib/datadog/tracing/transport/http.rb', line 33 def new(&block) Builder.new(&block).to_transport end |