Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP adapter renamed to :http #3406

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/datadog/core/configuration/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sig/datadog/core/transport/ext.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Datadog
module Transport
module Ext
module HTTP
ADAPTER: :net_http
ADAPTER: :http

DEFAULT_HOST: "127.0.0.1"

Expand Down
14 changes: 7 additions & 7 deletions spec/datadog/core/configuration/agent_settings_resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/tracing/contrib/support/tracer_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/tracing/transport/http/benchmark_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 } }

Expand Down
6 changes: 3 additions & 3 deletions spec/datadog/tracing/transport/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -72,7 +72,7 @@

let(:options) { {} }

let(:adapter) { :net_http }
let(:adapter) { :http }
let(:ssl) { nil }
let(:hostname) { nil }
let(:port) { nil }
Expand Down Expand Up @@ -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
Loading