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

rack instrumentation: continue trace from distributed trace digest only when distributed trace is present #4398

Merged
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
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/rack/middlewares.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def call(env)
# so that all spans will be added to the distributed trace.
if configuration[:distributed_tracing]
trace_digest = Contrib::HTTP.extract(env)
Tracing.continue_trace!(trace_digest)
Tracing.continue_trace!(trace_digest) if trace_digest
end

TraceProxyMiddleware.call(env, configuration) do
Expand Down
2 changes: 2 additions & 0 deletions spec/datadog/tracing/contrib/rack/distributed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@

shared_examples_for 'a Rack request without distributed tracing' do
it 'produces a non-distributed Rack trace' do
expect(Datadog::Tracing).not_to receive(:continue_trace!)

is_expected.to be_ok
expect(span).to_not be nil
expect(span.name).to eq('rack.request')
Expand Down
Loading