Skip to content

Commit

Permalink
Fixed celery tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Feb 22, 2024
1 parent 357ae7e commit 70140a6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,23 @@ def iter_trace_propagation_headers(self, *args, **kwargs):
for header in span.iter_headers():
yield header
else:
for header in self.iter_headers():
yield header
# If this scope has a propagation context, return headers from there
# (it could be that self is not the current scope nor the isolation scope)
if self._propagation_context is not None:
for header in self.iter_headers():
yield header

Check warning on line 624 in sentry_sdk/scope.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/scope.py#L624

Added line #L624 was not covered by tests
else:
# otherwise try headers from current scope
current_scope = Scope.get_current_scope()
if current_scope._propagation_context is not None:
for header in current_scope.iter_headers():
yield header

Check warning on line 630 in sentry_sdk/scope.py

View check run for this annotation

Codecov / codecov/patch

sentry_sdk/scope.py#L630

Added line #L630 was not covered by tests
else:
# otherwise fall back to headers from isolation scope
isolation_scope = Scope.get_isolation_scope()
if isolation_scope._propagation_context is not None:
for header in isolation_scope.iter_headers():
yield header

def get_active_propagation_context(self):
# type: () -> Dict[str, Any]
Expand Down

0 comments on commit 70140a6

Please sign in to comment.