Skip to content

Commit

Permalink
Remove older should_skip_distributed_tracing?
Browse files Browse the repository at this point in the history
  • Loading branch information
vpellan committed Dec 9, 2024
1 parent 7e8cf81 commit 3142efb
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 83 deletions.
11 changes: 0 additions & 11 deletions lib/datadog/tracing/contrib/http/circuit_breaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ def internal_request?(request)
!!(request[Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION] ||
request[Datadog::Core::Transport::Ext::HTTP::HEADER_DD_INTERNAL_UNTRACED_REQUEST])
end

def should_skip_distributed_tracing?(client_config, trace)
unless Datadog.configuration.tracing.apm.enabled
return true unless trace
return true if trace.non_billing_reject?
end

return !client_config[:distributed_tracing] if client_config && client_config.key?(:distributed_tracing)

!Datadog.configuration.tracing[:http][:distributed_tracing]
end
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions sig/datadog/tracing/contrib/http/circuit_breaker.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ module Datadog
module CircuitBreaker
def should_skip_tracing?: (untyped request) -> (true | false)
def internal_request?: (untyped request) -> bool

def should_skip_distributed_tracing?: (untyped client_config, Datadog::Tracing::TraceOperation trace) -> bool
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions sig/datadog/tracing/contrib/httpclient/instrumentation.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ module Datadog

def logger: () -> untyped

def should_skip_distributed_tracing?: (untyped client_config, Datadog::Tracing::TraceOperation trace) -> bool

def set_analytics_sample_rate: (untyped span, untyped request_options) -> (nil | untyped)
end
end
Expand Down
2 changes: 0 additions & 2 deletions sig/datadog/tracing/contrib/httprb/instrumentation.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ module Datadog

def logger: () -> untyped

def should_skip_distributed_tracing?: (untyped client_config, Datadog::Tracing::TraceOperation trace) -> bool

def set_analytics_sample_rate: (untyped span, untyped request_options) -> (nil | untyped)
end
end
Expand Down
66 changes: 0 additions & 66 deletions spec/datadog/tracing/contrib/http/circuit_breaker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,70 +91,4 @@
end
end
end

describe '#should_skip_distributed_tracing?' do
subject(:should_skip_distributed_tracing?) do
circuit_breaker.should_skip_distributed_tracing?(client_config, active_trace)
end

let(:client_config) { nil }
let(:distributed_tracing) { true }
let(:tracing_apm_enabled) { true }
let(:active_trace) { nil }
let(:non_billing_reject) { true }

before do
allow(Datadog.configuration.tracing[:http]).to receive(:[]).with(:distributed_tracing).and_return(distributed_tracing)
allow(Datadog.configuration.tracing.apm).to receive(:enabled).and_return(tracing_apm_enabled)
allow(Datadog::Tracing).to receive(:active_trace).and_return(active_trace)
allow(active_trace).to receive(:non_billing_reject?).and_return(non_billing_reject) if active_trace
end

context 'when distributed tracing is enabled' do
it { is_expected.to be false }
end

context 'when distributed tracing is disabled' do
let(:distributed_tracing) { false }

it { is_expected.to be true }
end

context 'when non billing mode is enabled' do
let(:tracing_apm_enabled) { false }

context 'when there is no active trace' do
it { is_expected.to be true }
end

context 'when there is an active trace' do
let(:active_trace) { instance_double(Datadog::Tracing::TraceOperation) }

context 'when the active trace must be rejected' do
it { is_expected.to be true }
end

context 'when the active trace must not be rejected' do
# This should act like non-billing mode is disabled, as it does not return in the
# `if Datadog.configuration.tracing.apm.enabled` block
# so we're only testing the "no client config, distributed tracing enabled" case here
let(:non_billing_reject) { false }

it { is_expected.to be false }
end
end
end

context 'given a client config with distributed_tracing disabled' do
let(:client_config) { { distributed_tracing: false } }

it { is_expected.to be true }
end

context 'given a client config with distributed_tracing enabled' do
let(:client_config) { { distributed_tracing: true } }

it { is_expected.to be false }
end
end
end

0 comments on commit 3142efb

Please sign in to comment.