Skip to content
Open
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
18 changes: 3 additions & 15 deletions ddtrace/propagation/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
from ddtrace.internal import core
from ddtrace.internal.telemetry import telemetry_writer
from ddtrace.internal.telemetry.constants import TELEMETRY_NAMESPACE
from ddtrace.internal.utils.deprecations import DDTraceDeprecationWarning
from ddtrace.settings._config import config
from ddtrace.settings.asm import config as asm_config
from ddtrace.vendor.debtcollector import deprecate

from ..constants import AUTO_KEEP
from ..constants import AUTO_REJECT
Expand Down Expand Up @@ -1121,7 +1119,7 @@ def _resolve_contexts(contexts, styles_w_ctx, normalized_headers):
return primary_context

@staticmethod
def inject(context: Union[Context, Span], headers: Dict[str, str], non_active_span: Optional[Span] = None) -> None:
def inject(context: Union[Context, Span], headers: Dict[str, str]) -> None:
"""Inject Context attributes that have to be propagated as HTTP headers.

Here is an example using `requests`::
Expand Down Expand Up @@ -1150,26 +1148,16 @@ def parent_call():
Span objects automatically trigger sampling decisions. Context objects should have
sampling_priority set to avoid inconsistent downstream sampling.
:param dict headers: HTTP headers to extend with tracing attributes.
:param Span non_active_span: **DEPRECATED** - Pass Span objects to the context parameter instead.
"""
if non_active_span is not None:
# non_active_span is only used for sampling decisions, not to inject headers.
deprecate(
"The non_active_span parameter is deprecated",
message="Use the context parameter instead.",
category=DDTraceDeprecationWarning,
removal_version="4.0.0",
)
# Cannot rename context parameter due to backwards compatibility
# Handle sampling and get context for header injection
span_context = HTTPPropagator._get_sampled_injection_context(context, non_active_span)
span_context = HTTPPropagator._get_sampled_injection_context(context, None)
# Log a warning if we cannot determine a sampling decision before injecting headers.
if span_context.span_id and span_context.trace_id and span_context.sampling_priority is None:
log.debug(
"Sampling decision not available. Downstream spans will not inherit a sampling priority: "
"args=(context=%s, ..., non_active_span=%s) detected span context=%s",
"args=(context=%s, ...) detected span context=%s",
context,
non_active_span,
span_context,
)

Expand Down
Loading