Skip to content

Commit

Permalink
Fixed generation of baggage when a dsc is already in propagation cont…
Browse files Browse the repository at this point in the history
…ext (#2232)
  • Loading branch information
antonpirker authored Jul 5, 2023
1 parent a7b3136 commit 1eb9600
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sentry_sdk/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ def trace_propagation_meta(self, span=None):
Return meta tags which should be injected into HTML templates
to allow propagation of trace information.
"""
if span is None:
if span is not None:
logger.warning(
"The parameter `span` in trace_propagation_meta() is deprecated and will be removed in the future."
)
Expand Down
9 changes: 6 additions & 3 deletions sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,13 @@ def get_baggage(self):
if self._propagation_context is None:
return None

if self._propagation_context.get("dynamic_sampling_context") is None:
dynamic_sampling_context = self._propagation_context.get(
"dynamic_sampling_context"
)
if dynamic_sampling_context is None:
return Baggage.from_options(self)

return None
else:
return Baggage(dynamic_sampling_context)

def get_trace_context(self):
# type: () -> Any
Expand Down

0 comments on commit 1eb9600

Please sign in to comment.