Skip to content

Commit 1eb9600

Browse files
authored
Fixed generation of baggage when a dsc is already in propagation context (#2232)
1 parent a7b3136 commit 1eb9600

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

sentry_sdk/hub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ def trace_propagation_meta(self, span=None):
814814
Return meta tags which should be injected into HTML templates
815815
to allow propagation of trace information.
816816
"""
817-
if span is None:
817+
if span is not None:
818818
logger.warning(
819819
"The parameter `span` in trace_propagation_meta() is deprecated and will be removed in the future."
820820
)

sentry_sdk/scope.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,13 @@ def get_baggage(self):
254254
if self._propagation_context is None:
255255
return None
256256

257-
if self._propagation_context.get("dynamic_sampling_context") is None:
257+
dynamic_sampling_context = self._propagation_context.get(
258+
"dynamic_sampling_context"
259+
)
260+
if dynamic_sampling_context is None:
258261
return Baggage.from_options(self)
259-
260-
return None
262+
else:
263+
return Baggage(dynamic_sampling_context)
261264

262265
def get_trace_context(self):
263266
# type: () -> Any

0 commit comments

Comments
 (0)