Skip to content

Commit 113b461

Browse files
authored
Made NoOpSpan compatible to Transactions. (#2364)
Added missing methods from the Transaction to the NoOpSpan because start_transaction sometimes returns a Span (and thus sometimes a NoOpSpan)
1 parent d26b91c commit 113b461

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

sentry_sdk/tracing.py

+25
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,11 @@ def __repr__(self):
876876
# type: () -> str
877877
return self.__class__.__name__
878878

879+
@property
880+
def containing_transaction(self):
881+
# type: () -> Optional[Transaction]
882+
return None
883+
879884
def start_child(self, instrumenter=INSTRUMENTER.SENTRY, **kwargs):
880885
# type: (str, **Any) -> NoOpSpan
881886
return NoOpSpan()
@@ -892,6 +897,10 @@ def to_baggage(self):
892897
# type: () -> Optional[Baggage]
893898
return None
894899

900+
def get_baggage(self):
901+
# type: () -> Optional[Baggage]
902+
return None
903+
895904
def iter_headers(self):
896905
# type: () -> Iterator[Tuple[str, str]]
897906
return iter(())
@@ -928,6 +937,22 @@ def finish(self, hub=None, end_timestamp=None):
928937
# type: (Optional[sentry_sdk.Hub], Optional[datetime]) -> Optional[str]
929938
pass
930939

940+
def set_measurement(self, name, value, unit=""):
941+
# type: (str, float, MeasurementUnit) -> None
942+
pass
943+
944+
def set_context(self, key, value):
945+
# type: (str, Any) -> None
946+
pass
947+
948+
def init_span_recorder(self, maxlen):
949+
# type: (int) -> None
950+
pass
951+
952+
def _set_initial_sampling_decision(self, sampling_context):
953+
# type: (SamplingContext) -> None
954+
pass
955+
931956

932957
def trace(func=None):
933958
# type: (Any) -> Any

0 commit comments

Comments
 (0)