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

Remove deprecated HTTP Transport methods #3335

Merged
merged 1 commit into from
Dec 19, 2023
Merged
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
27 changes: 0 additions & 27 deletions lib/datadog/core/remote/transport/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,33 +135,6 @@ def default_adapter
Datadog::Core::Transport::Ext::HTTP::ADAPTER
end

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: I wonder if DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS still gets used in practice, or if it is a no-op default that always gets replaced by whatever we pass in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I played around with dependency injection, I did find I believe 1 or 2 places that really still use it, and all the other references were non-functional (value is passed, but never used).

end

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

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

# Add adapters to registry
Builder::REGISTRY.set(Datadog::Core::Transport::HTTP::Adapters::Net, Datadog::Core::Transport::Ext::HTTP::ADAPTER)
Builder::REGISTRY.set(
Expand Down
27 changes: 0 additions & 27 deletions lib/datadog/tracing/transport/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,33 +84,6 @@ def default_adapter
Datadog::Core::Transport::Ext::HTTP::ADAPTER
end

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

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

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

# Add adapters to registry
Builder::REGISTRY.set(Datadog::Core::Transport::HTTP::Adapters::Net, Datadog::Core::Transport::Ext::HTTP::ADAPTER)
Builder::REGISTRY.set(Datadog::Core::Transport::HTTP::Adapters::Test, Datadog::Core::Transport::Ext::Test::ADAPTER)
Expand Down
60 changes: 0 additions & 60 deletions spec/datadog/tracing/transport/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,64 +198,4 @@

it { is_expected.to be(:net_http) }
end

describe '.default_hostname' do
subject(:default_hostname) { described_class.default_hostname(logger: logger) }

let(:logger) { instance_double(Datadog::Core::Logger, warn: nil) }

before do
stub_const(
'Datadog::Tracing::Transport::HTTP::DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS',
instance_double(Datadog::Core::Configuration::AgentSettingsResolver::AgentSettings, hostname: 'example-hostname')
)
end

it 'returns the hostname from the DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS object' do
expect(default_hostname).to eq 'example-hostname'
end

it 'logs a deprecation warning' do
expect(logger).to receive(:warn).with(/Deprecated/)

default_hostname
end
end

describe '.default_port' do
subject(:default_port) { described_class.default_port(logger: logger) }

let(:logger) { instance_double(Datadog::Core::Logger, warn: nil) }

before do
stub_const(
'Datadog::Tracing::Transport::HTTP::DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS',
instance_double(Datadog::Core::Configuration::AgentSettingsResolver::AgentSettings, port: 12345)
)
end

it 'returns the port from the DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS object' do
expect(default_port).to eq 12345
end

it 'logs a deprecation warning' do
expect(logger).to receive(:warn).with(/Deprecated/)

default_port
end
end

describe '.default_url' do
subject(:default_url) { described_class.default_url(logger: logger) }

let(:logger) { instance_double(Datadog::Core::Logger, warn: nil) }

it { is_expected.to be nil }

it 'logs a deprecation warning' do
expect(logger).to receive(:warn).with(/Deprecated/)

default_url
end
end
end
Loading