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

fix(pdk) - respect the trace flags from the parent span (if present) #13015

Closed
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**Opentelemetry**: respect the trace flags from the parent span (if present) before applying sampling"
type: bugfix
scope: PDK
8 changes: 4 additions & 4 deletions kong/pdk/tracing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,9 @@ local function new_tracer(name, options)

--- Get the sampling decision result
--
-- Uses a parent-based sampler when the parent has sampled flag == false
-- to inherit the non-recording decision from the parent span, or when
-- trace_id is not available.
-- Uses a parent-based sampler when the parent has sampled flag set
-- to inherit the decision from the parent span, or when trace_id is
-- not available.
--
-- Else, apply the probability-based should_sample decision.
--
Expand All @@ -587,7 +587,7 @@ local function new_tracer(name, options)
-- a dummy created only to propagate headers
sampled = false

elseif parent_should_sample == false or not trace_id then
elseif parent_should_sample ~= nil or not trace_id then
-- trace_id can be nil when tracing instrumentations are disabled
-- and Kong is configured to only do headers propagation
sampled = parent_should_sample
Expand Down
Loading