Skip to content

Commit

Permalink
Fix gRPC specs
Browse files Browse the repository at this point in the history
  • Loading branch information
vpellan committed Dec 9, 2024
1 parent 3d54594 commit 7e8cf81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
18 changes: 10 additions & 8 deletions spec/datadog/tracing/contrib/faraday/middleware_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@
let(:middleware_options) { {} }
let(:configuration_options) { {} }
let(:response_headers) { {} }
let(:non_billing_mode) { false }

before do
Datadog.configure do |c|
c.tracing.instrument :faraday, configuration_options
c.tracing.apm.enabled = !non_billing_mode
end
end

Expand Down Expand Up @@ -415,15 +413,19 @@
context 'when non-billing mode is enabled' do
subject(:response) { client.get('/success') }

let(:non_billing_mode) { true }
before do
Datadog.configure do |c|
c.tracing.apm.enabled = false
end
# This cannot happen in actual apps but we do this to
# verify that sampling priority is set to 0 through distributed tracing without mocking an agent
allow(Datadog::Tracing::Distributed::Helpers).to receive(:should_skip_distributed_tracing?).and_return(false)
end

let(:headers) { response.env.request_headers }

it do
expect(headers).to include(
'x-datadog-trace-id' => low_order_trace_id(span.trace_id).to_s,
'x-datadog-parent-id' => span.id.to_s,
'x-datadog-sampling-priority' => '0'
)
expect(headers).to include('x-datadog-sampling-priority' => '0')
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@
end

context 'with non-billing mode' do
# We cannot get the trace as it is sent and flushed.
# But we can verify non-billing mode through distributed tracing

# Not sure why, putting a before block here has no effect
let(:tracing_apm_enabled) { false }
let(:force_execute_distributed_tracing) { true }
Expand Down

0 comments on commit 7e8cf81

Please sign in to comment.