@@ -355,7 +355,7 @@ def _end(self, end_timestamp: "Optional[Union[float, datetime]]" = None) -> None
355355 return
356356
357357 # Stop the profiler
358- if self .is_segment ():
358+ if self ._is_segment ():
359359 if self ._continuous_profile is not None :
360360 self ._continuous_profile .stop ()
361361
@@ -474,8 +474,8 @@ def start_timestamp(self) -> "Optional[datetime]":
474474 def timestamp (self ) -> "Optional[datetime]" :
475475 return self ._timestamp
476476
477- def is_segment (self ) -> bool :
478- return self ._segment == self
477+ def _is_segment (self ) -> bool :
478+ return self ._segment is self
479479
480480 def _dynamic_sampling_context (self ) -> "dict[str, str]" :
481481 return self ._segment ._get_baggage ().dynamic_sampling_context ()
@@ -556,7 +556,7 @@ def _get_trace_context(self) -> "dict[str, Any]":
556556 return context
557557
558558 def _start_profile (self ) -> None :
559- if not self .is_segment ():
559+ if not self ._is_segment ():
560560 return
561561
562562 try_autostart_continuous_profiler ()
@@ -691,8 +691,8 @@ def set_attributes(self, attributes: "Attributes") -> None:
691691 def remove_attribute (self , key : str ) -> None :
692692 pass
693693
694- def is_segment (self ) -> bool :
695- return False
694+ def _is_segment (self ) -> bool :
695+ return self . _scope is not None
696696
697697 def _to_traceparent (self ) -> str :
698698 propagation_context = (
0 commit comments