Skip to content

Commit

Permalink
Prevent adding sentry-trace header multiple times (#2235)
Browse files Browse the repository at this point in the history
If OpenTelementry is enabled, the sentry-trace headers should not be applied by Sentry intregration, but only by the OTel propagator.

Fixes #1940
  • Loading branch information
antonpirker committed Jul 11, 2023
1 parent 684c43f commit b89fa8d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,18 @@ def new_span(self, **kwargs):
# type: (**Any) -> NoOpSpan
return self.start_child(**kwargs)

def to_traceparent(self):
# type: () -> str
return ""

def to_baggage(self):
# type: () -> Optional[Baggage]
return None

def iter_headers(self):
# type: () -> Iterator[Tuple[str, str]]
return iter(())

def set_tag(self, key, value):
# type: (str, Any) -> None
pass
Expand All @@ -820,6 +832,18 @@ def set_http_status(self, http_status):
# type: (int) -> None
pass

def is_success(self):
# type: () -> bool
return True

def to_json(self):
# type: () -> Dict[str, Any]
return {}

def get_trace_context(self):
# type: () -> Any
return {}

def finish(self, hub=None, end_timestamp=None):
# type: (Optional[sentry_sdk.Hub], Optional[datetime]) -> Optional[str]
pass
Expand Down

0 comments on commit b89fa8d

Please sign in to comment.