feat(tracing): Handle `tracestate` HTTP headers/correlation context envelope headers by lobsterkatie · Pull Request #971 · getsentry/sentry-python · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1782974
add base64 conversion methods
lobsterkatie Jan 13, 2021
b187c2f
add method to compute a transaction's tracestate value
lobsterkatie Jan 13, 2021
bba2880
add methods for extracting data from sentry-trace and tracestate headers
lobsterkatie Jan 13, 2021
94099d2
add sentry and third-party tracestate attributes to Transaction class
lobsterkatie Jan 13, 2021
f6de104
pass sentry tracestate in event.contexts.trace for extraction when en…
lobsterkatie Jan 13, 2021
5727ffc
update docstrings
lobsterkatie Jan 13, 2021
dfbcbb7
use header data extraction methods rather than from_traceparent
lobsterkatie Jan 13, 2021
e2fbc7a
add trace correlation context to envelope header
lobsterkatie Jan 13, 2021
a479936
add to_tracestate and use it in iter_headers
lobsterkatie Jan 15, 2021
60014d2
deprecate from_traceparent
lobsterkatie Jan 15, 2021
c6e19e4
make base64 conversion methods handle errors, add tests
lobsterkatie Jan 19, 2021
2e0c7c2
fix tracestate extraction, add tests
lobsterkatie Jan 20, 2021
bc276ae
fix bugs in to_tracestate, add tests
lobsterkatie Jan 20, 2021
197217f
handle errors when attaching trace data to envelope headers
lobsterkatie Jan 20, 2021
fc19e88
move all tracing tests to tests/tracing
lobsterkatie Jan 25, 2021
a5900c1
split up tracestate computation, make it work for spans, too
lobsterkatie Jan 25, 2021
850c903
add method for reinflating tracestate
lobsterkatie Jan 25, 2021
4eb0cfb
do base64 validation manually because py2
lobsterkatie Jan 25, 2021
46ff29b
fixup splitting tracestate calculation
lobsterkatie Jan 25, 2021
6edac13
compute new tracestate value for orphan spans
lobsterkatie Jan 25, 2021
a4f8395
use reinflation method in client
lobsterkatie Jan 25, 2021
25edca9
add lots of tests
lobsterkatie Jan 25, 2021
d3a6303
general cleanup
lobsterkatie Jan 25, 2021
97a4aaf
store full sentry entry (rather than value) for tracestate
lobsterkatie Feb 26, 2021
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
29 changes: 22 additions & 7 deletions sentry_sdk/client.py
8 changes: 6 additions & 2 deletions sentry_sdk/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,10 @@ def flush(

def iter_trace_propagation_headers(self):
# type: () -> Generator[Tuple[str, str], None, None]
# TODO: Document
"""
Returns a generator for the headers to attach to outgoing requests when
tracing.
"""
client, scope = self._stack[-1]
span = scope.span

Expand All @@ -695,7 +698,8 @@ def iter_trace_propagation_headers(self):
if not propagate_traces:
return

yield "sentry-trace", span.to_traceparent()
for header in span.iter_headers():
yield header


GLOBAL_HUB = Hub()
Expand Down
126 changes: 78 additions & 48 deletions sentry_sdk/tracing.py
Loading