Skip to content

Commit 3412a6e

Browse files
committed
Propagate sampling priority only if defined
1 parent 8142e3f commit 3412a6e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ddtrace/propagation/http.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def parent_call():
3030
"""
3131
headers[HTTP_HEADER_TRACE_ID] = str(span_context.trace_id)
3232
headers[HTTP_HEADER_PARENT_ID] = str(span_context.span_id)
33-
headers[HTTP_HEADER_SAMPLING_PRIORITY] = str(span_context.sampling_priority)
33+
sampling_priority = span_context.sampling_priority
34+
# Propagate priority only if defined
35+
if sampling_priority is not None:
36+
headers[HTTP_HEADER_SAMPLING_PRIORITY] = str(span_context.sampling_priority)
3437

3538
def extract(self, headers):
3639
"""Extract a Context from HTTP headers into a new Context.

0 commit comments

Comments
 (0)