Skip to content

Commit

Permalink
check that context.sampling_priority is None, not just is
Browse files Browse the repository at this point in the history
  • Loading branch information
ZStriker19 committed Mar 1, 2024
1 parent 570acc3 commit fab0b27
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ddtrace/_trace/processor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def process_trace(self, trace):
root_ctx = chunk_root._context

# only sample if we haven't already sampled
if root_ctx and not root_ctx.sampling_priority:
if root_ctx and root_ctx.sampling_priority is None:
self.sampler.sample(trace[0])
# When stats computation is enabled in the tracer then we can
# safely drop the traces.
Expand Down
2 changes: 1 addition & 1 deletion ddtrace/_trace/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def deregister_on_start_span(self, func: Callable) -> Callable:

def sample_before_fork(self) -> None:
span = self.current_root_span()
if span is not None and not span.context.sampling_priority:
if span is not None and span.context.sampling_priority is None:
self._sampler.sample(span)

@property
Expand Down
2 changes: 1 addition & 1 deletion ddtrace/propagation/_database_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(

def inject(self, dbspan, args, kwargs):
# run sampling before injection to propagate correct sampling priority
if ddtrace.tracer._sampler and not dbspan.context.sampling_priority:
if ddtrace.tracer._sampler and dbspan.context.sampling_priority is None:
ddtrace.tracer._sampler.sample(dbspan._local_root)

dbm_comment = self._get_dbm_comment(dbspan)
Expand Down
2 changes: 1 addition & 1 deletion ddtrace/propagation/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ def parent_call():
else:
span = span._local_root
if span is not None:
if not span.context.sampling_priority:
if span.context.sampling_priority is None:
ddtrace.tracer._sampler.sample(span._local_root)
if PROPAGATION_STYLE_DATADOG in config._propagation_style_inject:
_DatadogMultiHeader._inject(span_context, headers)
Expand Down

0 comments on commit fab0b27

Please sign in to comment.