Skip to content

Commit 1d50bf0

Browse files
committed
Add trace_propagation_meta helper to hub to generate meta tags
1 parent 7b972eb commit 1d50bf0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sentry_sdk/hub.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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

721734
GLOBAL_HUB = Hub()
722735
_local.set(GLOBAL_HUB)

0 commit comments

Comments
 (0)