-
Notifications
You must be signed in to change notification settings - Fork 402
Open
Labels
bugInvolves a bugInvolves a bugcommunityWas opened by a community memberWas opened by a community member
Description
Tracer Version(s)
2.29.0, 2.31.0
Ruby Version(s)
3.4.5
Relevent Library and Version(s)
No response
Bug Report
The rescue block in Datadog::Tracing::Distributed::Datadog#extract_tags implicitly returns true (the return value of Logger#warn) instead of nil when a decoding error occurs.
This true is passed to extract_trace_id!, which calls .delete on it, raising a NoMethodError.
The same implicit return pattern exists in the inject_tags! rescue block, though it doesn't currently trigger a downstream error.
Expected behavior
#extract returns a valid TraceDigest (ignoring the malformed tags gracefully), and a warning is logged.
Actual behavior
NoMethodError: undefined method 'delete' for true
raised from extract_trace_id! (https://github.com/DataDog/dd-trace-rb/blob/e3406de/lib/datadog/tracing/distributed/datadog.rb#L117) because extract_tags returned true instead
of nil.Errors with stack traces
NoMethodError: undefined method 'delete' for true
from lib/datadog/tracing/distributed/datadog.rb:117:in 'extract_trace_id!'
from lib/datadog/tracing/distributed/datadog.rb:73:in 'extract'Impact
In our production environment, this generates ~30,000+ error logs per day. Any application receiving requests with malformed x-datadog-tags headers hits this.
Reproduction Code
propagator = Datadog::Tracing::Distributed::Datadog.new(
fetcher: Datadog::Tracing::Distributed::Fetcher
)
propagator.extract({
"x-datadog-trace-id" => "1234567890",
"x-datadog-parent-id" => "9876543210",
"x-datadog-tags" => "malformed_value"
})Configuration Block
Datadog.configure do |c|
c.tracing.enabled = true
c.tracing.log_injection = true
c.tracing.instrument :rack, quantize: { base: :show, query: { show: :all, obfuscate: :internal } }
c.tracing.instrument :rails
c.tracing.contrib.global_default_service_name.enabled = true
endError Logs
Operating System
Linux x86_64 6.19.6-arch1-1 GNU/Linux
How does Datadog help you?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugInvolves a bugInvolves a bugcommunityWas opened by a community memberWas opened by a community member