-
Notifications
You must be signed in to change notification settings - Fork 377
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
comment_propagation: 'full' throws an error when DD_TRACE_ENABLED is false #3047
Comments
Thanks for reporting this! @TonyCTHsu any thoughts? Given you've done some work on this DBM feature? |
👋 @nightpool , we have already released a fix for this in https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md#1120---2023-06-02 |
I hit this error in 1.12.1. |
👋 @camsteffen , Could you provide me your backtrace and ways to reproduce it? Currently, I expect to see
|
Maybe my case is a little bit different. Here is a reproduction script. rails new dd-int-nil && cd dd-int-nil
bundle add sidekiq
bundle add ddtrace --require 'ddtrace/auto_instrument'
rails generate sidekiq:job my
cat <<EOF > config/initializers/datadog.rb
Rails.application.config.after_initialize do |app|
Datadog.configure do |c|
c.tracing.enabled = false
c.tracing.distributed_tracing.propagation_style = ["tracecontext"]
c.tracing.instrument :sidekiq, distributed_tracing: true
end
end
EOF
rails runner 'MyJob.perform_async' Error output:
|
👋 @camsteffen , This is an rescued error when propagating trace context for distributed tracing. The code tried to inject context with the trace, however, since tracing is disabled. The trace failed to converted into the format could be injected. We rescued this error and output the warning. As far as I could tell, you code would still ran without problem. |
That's true it wouldn't break my code, but the error is an unnecessary distraction. |
This is fixed for later versions and backport might happen: #3724 (comment) |
Current behaviour
All DB methods throw an error when
DD_TRACE_ENABLED
is set tofalse
Expected behaviour
build_traceparent_string
correctly handles the case wheretrace_id
andspan_id
might be nil.This seems pretty straightforward. We call the
build_traceparent
private method directly fromSqlComment
:dd-trace-rb/lib/datadog/tracing/contrib/propagation/sql_comment.rb
Line 32 in 1dc95e2
But in the case where tracing is disabled,
trace_op
is set to dummy nil values byskip_trace
:dd-trace-rb/lib/datadog/tracing/tracer.rb
Lines 519 to 528 in 1dc95e2
which bypasses
build_span
where we set parent_trace_id to 0:dd-trace-rb/lib/datadog/tracing/trace_operation.rb
Line 214 in 28c3c3e
Which blows up when we try to serialize it:
dd-trace-rb/lib/datadog/tracing/distributed/trace_context.rb
Line 116 in 867b104
Steps to reproduce
c.tracing.instrument :pg, comment_propagation: 'full'
DD_TRACE_ENABLED
to befalse
Environment
The text was updated successfully, but these errors were encountered: