File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -717,6 +717,19 @@ def iter_trace_propagation_headers(self, span=None):
717717 for header in span .iter_headers ():
718718 yield header
719719
720+ def trace_propagation_meta (self , span = None ):
721+ # type: (Optional[Span]) -> str
722+ """
723+ Return meta tags which should be injected into the HTML template
724+ to allow propagation of trace data.
725+ """
726+ meta = ""
727+
728+ for name , content in self .iter_trace_propagation_headers (span ):
729+ meta += '<meta name="%s" content="%s">' % (name , content )
730+
731+ return meta
732+
720733
721734GLOBAL_HUB = Hub ()
722735_local .set (GLOBAL_HUB )
Original file line number Diff line number Diff line change @@ -477,7 +477,6 @@ def populate_from_transaction(cls, transaction):
477477 Populate fresh baggage entry with sentry_items and make it immutable
478478 if this is the head SDK which originates traces.
479479 """
480-
481480 hub = transaction .hub or sentry_sdk .Hub .current
482481 client = hub .client
483482 sentry_items = {} # type: Dict[str, str]
@@ -511,6 +510,12 @@ def populate_from_transaction(cls, transaction):
511510 if transaction .sample_rate is not None :
512511 sentry_items ["sample_rate" ] = str (transaction .sample_rate )
513512
513+ # there's an existing baggage but it was mutable,
514+ # which is why we are creating this new baggage.
515+ # However, if by chance the user put some sentry items in there, give them precedence.
516+ if transaction ._baggage and transaction ._baggage .sentry_items :
517+ sentry_items .update (transaction ._baggage .sentry_items )
518+
514519 return Baggage (sentry_items , mutable = False )
515520
516521 def freeze (self ):
You can’t perform that action at this time.
0 commit comments