@@ -649,17 +649,20 @@ def _set_segment_attributes(self) -> None:
649649
650650
651651class NoOpStreamedSpan (StreamedSpan ):
652- def __init__ (self , name : "Optional[str]" = None , scope : "Optional[sentry_sdk.Scope]" = None , ** kwargs : "Any" ) -> None :
653- self .name = name
654- self .parent_span_id = None
655- self .segment = None
656- self ._scope = scope
657- self ._context_manager_state = None
652+ __slots__ = (
653+ "name" ,
654+ "segment" ,
655+ "_scope" ,
656+ "_context_manager_state" ,
657+ )
658+
659+ def __init__ (self , scope : "Optional[sentry_sdk.Scope]" = None , ** kwargs : "Any" ) -> None :
660+ self .segment = None # type: ignore[assignment]
661+ self ._scope = scope # type: ignore[assignment]
658662
659663 def __repr__ (self ) -> str :
660664 return (
661665 f"<{ self .__class__ .__name__ } ("
662- f"name={ self .name } , "
663666 f"sampled={ self .sampled } )>"
664667 )
665668
@@ -689,21 +692,21 @@ def __exit__(
689692 quantity = 1 ,
690693 )
691694
692- if self ._context_manager_state is None :
695+ if self ._scope is None :
693696 return
694697
695698 with capture_internal_exceptions ():
696699 scope , old_span = self ._context_manager_state
697700 del self ._context_manager_state
698701 scope .span = old_span
699702
700- def start (self ) -> None :
703+ def start (self ) -> "NoOpStreamedSpan" :
701704 return self .__enter__ ()
702705
703- def end (self ) -> None :
706+ def end (self , end_timestamp : "Optional[Union[float, datetime]]" = None ) -> None :
704707 self .__exit__ (None , None , None )
705708
706- def finish (self ) -> None :
709+ def finish (self , end_timestamp : "Optional[Union[float, datetime]]" = None ) -> None :
707710 pass
708711
709712 def get_attributes (self ) -> "Attributes" :
@@ -712,7 +715,7 @@ def get_attributes(self) -> "Attributes":
712715 def set_attribute (self , key : str , value : "AttributeValue" ) -> None :
713716 pass
714717
715- def set_attributes (self ) -> None :
718+ def set_attributes (self , attributes : "Attributes" ) -> None :
716719 pass
717720
718721 def remove_attribute (self , key : str ) -> None :
@@ -724,7 +727,7 @@ def set_name(self, name: str) -> None:
724727 def get_name (self ) -> str :
725728 return ""
726729
727- def set_flag (self ) -> None :
730+ def set_flag (self , flag : str , result : bool ) -> None :
728731 pass
729732
730733 def set_op (self , op : str ) -> None :
@@ -751,21 +754,6 @@ def trace_id(self) -> str:
751754 def sampled (self ) -> "Optional[bool]" :
752755 return False
753756
754- def dynamic_sampling_context (self ) -> dict [str , str ]:
755- return {}
756-
757- def get_baggage (self ) -> "Baggage" :
758- return Baggage ()
759-
760- def to_baggage (self ) -> "Optional[Baggage]" :
761- return None
762-
763- def to_traceparent (self ) -> str :
764- return "0000-0000-0"
765-
766- def iter_headers (self ) -> "Iterator[tuple[str, str]]" :
767- return
768-
769757 def _set_segment_attributes (self ) -> None :
770758 pass
771759
0 commit comments