Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix trace context in event payload #2205

Merged
merged 13 commits into from
Jun 28, 2023
8 changes: 4 additions & 4 deletions sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,11 @@ def _drop(cause, ty):

contexts = event.setdefault("contexts", {})

if has_tracing_enabled(options):
if self._span is not None:
if contexts.get("trace") is None:
if has_tracing_enabled(options) and self._span is not None:
contexts["trace"] = self._span.get_trace_context()
else:
contexts["trace"] = self.get_trace_context()
else:
contexts["trace"] = self.get_trace_context()

exc_info = hint.get("exc_info")
if exc_info is not None:
Expand Down