From 032287515def05667e6b369273fd6a203cb7c237 Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Thu, 25 Jan 2024 14:19:44 -0800 Subject: [PATCH] HTTP adapter renamed :http --- lib/datadog/core/configuration/ext.rb | 2 +- sig/datadog/core/transport/ext.rbs | 2 +- .../configuration/agent_settings_resolver_spec.rb | 14 +++++++------- .../tracing/contrib/elasticsearch/patcher_spec.rb | 2 +- .../contrib/elasticsearch/transport_spec.rb | 2 +- .../tracing/contrib/support/tracer_helpers.rb | 2 +- .../tracing/transport/http/benchmark_spec.rb | 2 +- spec/datadog/tracing/transport/http_spec.rb | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/datadog/core/configuration/ext.rb b/lib/datadog/core/configuration/ext.rb index 25b7d58b0ff..d08d9948482 100644 --- a/lib/datadog/core/configuration/ext.rb +++ b/lib/datadog/core/configuration/ext.rb @@ -30,7 +30,7 @@ module Agent ENV_DEFAULT_TIMEOUT_SECONDS = 'DD_TRACE_AGENT_TIMEOUT_SECONDS' module HTTP - ADAPTER = :net_http # DEV: Rename to simply `:http`, as Net::HTTP is an implementation detail. + ADAPTER = :http DEFAULT_HOST = '127.0.0.1' DEFAULT_PORT = 8126 DEFAULT_USE_SSL = false diff --git a/sig/datadog/core/transport/ext.rbs b/sig/datadog/core/transport/ext.rbs index 2aa7bd31df3..ed24634ffeb 100644 --- a/sig/datadog/core/transport/ext.rbs +++ b/sig/datadog/core/transport/ext.rbs @@ -3,7 +3,7 @@ module Datadog module Transport module Ext module HTTP - ADAPTER: :net_http + ADAPTER: :http DEFAULT_HOST: "127.0.0.1" diff --git a/spec/datadog/core/configuration/agent_settings_resolver_spec.rb b/spec/datadog/core/configuration/agent_settings_resolver_spec.rb index de0b2e24a30..513fbab5417 100644 --- a/spec/datadog/core/configuration/agent_settings_resolver_spec.rb +++ b/spec/datadog/core/configuration/agent_settings_resolver_spec.rb @@ -27,7 +27,7 @@ } end - let(:adapter) { :net_http } + let(:adapter) { :http } let(:hostname) { '127.0.0.1' } let(:port) { 8126 } let(:uds_path) { nil } @@ -171,7 +171,7 @@ let(:with_agent_host) { 'custom-hostname' } it 'prioritizes the http configuration' do - expect(resolver).to have_attributes(hostname: 'custom-hostname', adapter: :net_http) + expect(resolver).to have_attributes(hostname: 'custom-hostname', adapter: :http) end it 'logs a warning including the uds path' do @@ -187,7 +187,7 @@ context 'when there is no port specified' do it 'prioritizes the http configuration and uses the default port' do - expect(resolver).to have_attributes(port: 8126, hostname: 'custom-hostname', adapter: :net_http) + expect(resolver).to have_attributes(port: 8126, hostname: 'custom-hostname', adapter: :http) end it 'logs a warning including the hostname and default port' do @@ -205,7 +205,7 @@ let(:with_agent_port) { 1234 } it 'prioritizes the http configuration and uses the specified port' do - expect(resolver).to have_attributes(port: 1234, hostname: 'custom-hostname', adapter: :net_http) + expect(resolver).to have_attributes(port: 1234, hostname: 'custom-hostname', adapter: :http) end it 'logs a warning including the hostname and port' do @@ -224,7 +224,7 @@ let(:with_agent_port) { 5678 } it 'prioritizes the http configuration' do - expect(resolver).to have_attributes(port: 5678, adapter: :net_http) + expect(resolver).to have_attributes(port: 5678, adapter: :http) end it 'logs a warning including the uds path' do @@ -240,7 +240,7 @@ context 'when there is no hostname specified' do it 'prioritizes the http configuration and uses the default hostname' do - expect(resolver).to have_attributes(port: 5678, hostname: '127.0.0.1', adapter: :net_http) + expect(resolver).to have_attributes(port: 5678, hostname: '127.0.0.1', adapter: :http) end it 'logs a warning including the default hostname and port' do @@ -258,7 +258,7 @@ let(:with_agent_host) { 'custom-hostname' } it 'prioritizes the http configuration and uses the specified hostname' do - expect(resolver).to have_attributes(port: 5678, hostname: 'custom-hostname', adapter: :net_http) + expect(resolver).to have_attributes(port: 5678, hostname: 'custom-hostname', adapter: :http) end it 'logs a warning including the hostname and port' do diff --git a/spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb b/spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb index 259fc58e5af..89c8c5c71c4 100644 --- a/spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb +++ b/spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Datadog::Tracing::Contrib::Elasticsearch::Patcher do include_context 'Elasticsearch client' - let(:client) { Elasticsearch::Client.new(url: server, adapter: :net_http) } + let(:client) { Elasticsearch::Client.new(url: server, adapter: :http) } let(:configuration_options) { {} } before do diff --git a/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb b/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb index b461c7b817b..fa4c8699d67 100644 --- a/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb +++ b/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb @@ -29,7 +29,7 @@ let(:port) { ENV.fetch('TEST_ELASTICSEARCH_PORT', '1234').to_i } let(:server) { "http://#{host}:#{port}" } - let(:client) { Elasticsearch::Client.new(url: server, adapter: :net_http) } + let(:client) { Elasticsearch::Client.new(url: server, adapter: :http) } let(:configuration_options) { {} } before do diff --git a/spec/datadog/tracing/contrib/support/tracer_helpers.rb b/spec/datadog/tracing/contrib/support/tracer_helpers.rb index 9cb6316e294..e96318de082 100644 --- a/spec/datadog/tracing/contrib/support/tracer_helpers.rb +++ b/spec/datadog/tracing/contrib/support/tracer_helpers.rb @@ -104,7 +104,7 @@ def clear_traces! if tracer.respond_to?(:writer) && tracer.writer.transport.client.api.adapter.respond_to?(:hostname) && # rubocop:disable Style/SoleNestedConditional tracer.writer.transport.client.api.adapter.hostname == agent_host transport_options = { - adapter: :net_http, + adapter: :http, hostname: agent_host, port: agent_port, timeout: 30 diff --git a/spec/datadog/tracing/transport/http/benchmark_spec.rb b/spec/datadog/tracing/transport/http/benchmark_spec.rb index 26590023d2e..f0d358a6217 100644 --- a/spec/datadog/tracing/transport/http/benchmark_spec.rb +++ b/spec/datadog/tracing/transport/http/benchmark_spec.rb @@ -11,7 +11,7 @@ describe '#send' do let!(:default_transport) { Datadog::Tracing::Transport::HTTP.default } - let!(:net_transport) { Datadog::Tracing::Transport::HTTP.default { |t| t.adapter :net_http } } + let!(:net_transport) { Datadog::Tracing::Transport::HTTP.default { |t| t.adapter :http } } let!(:unix_transport) { Datadog::Tracing::Transport::HTTP.default { |t| t.adapter :unix } } let!(:test_transport) { Datadog::Tracing::Transport::HTTP.default { |t| t.adapter :test } } diff --git a/spec/datadog/tracing/transport/http_spec.rb b/spec/datadog/tracing/transport/http_spec.rb index 29e8eee6182..3f8bbe90557 100644 --- a/spec/datadog/tracing/transport/http_spec.rb +++ b/spec/datadog/tracing/transport/http_spec.rb @@ -53,7 +53,7 @@ expect(api.headers).to include(described_class.default_headers) case env_agent_settings.adapter - when :net_http + when :http expect(api.adapter).to be_a_kind_of(Datadog::Core::Transport::HTTP::Adapters::Net) expect(api.adapter.hostname).to eq(env_agent_settings.hostname) expect(api.adapter.port).to eq(env_agent_settings.port) @@ -72,7 +72,7 @@ let(:options) { {} } - let(:adapter) { :net_http } + let(:adapter) { :http } let(:ssl) { nil } let(:hostname) { nil } let(:port) { nil } @@ -183,6 +183,6 @@ describe '.default_adapter' do subject(:default_adapter) { described_class.default_adapter } - it { is_expected.to be(:net_http) } + it { is_expected.to be(:http) } end end