@@ -1200,6 +1200,7 @@ def __init__(
12001200 scope = None , # type: Optional[Scope]
12011201 start_timestamp = None , # type: Optional[Union[datetime, float]]
12021202 origin = None , # type: Optional[str]
1203+ name = None , # type: Optional[str]
12031204 ** _ , # type: dict[str, object]
12041205 ):
12051206 # type: (...) -> None
@@ -1224,6 +1225,7 @@ def __init__(
12241225 self .origin = origin or DEFAULT_SPAN_ORIGIN
12251226 self .op = op
12261227 self .description = description
1228+ self .name = name
12271229 if status is not None :
12281230 self .set_status (status )
12291231
@@ -1303,7 +1305,9 @@ def containing_transaction(self):
13031305 .. deprecated:: 3.0.0
13041306 This will be removed in the future. Use :func:`root_span` instead.
13051307 """
1306- logger .warning ("Deprecated: This will be removed in the future." )
1308+ logger .warning (
1309+ "Deprecated: This will be removed in the future. Use root_span instead."
1310+ )
13071311 return self .root_span
13081312
13091313 @containing_transaction .setter
@@ -1318,17 +1322,11 @@ def containing_transaction(self, value):
13181322
13191323 @property
13201324 def root_span (self ):
1321- if isinstance (self ._otel_span , otel_trace .NonRecordingSpan ):
1322- return None
1323-
1324- parent = None
1325- while True :
1326- if self ._otel_span .parent :
1327- parent = self ._otel_span .parent
1328- else :
1329- break
1330-
1331- return parent
1325+ # type: () -> Optional[POTelSpan]
1326+ # XXX implement this
1327+ # there's a span.parent property, but it returns the parent spancontext
1328+ # not sure if there's a way to retrieve the parent with pure otel.
1329+ return None
13321330
13331331 @root_span .setter
13341332 def root_span (self , value ):
@@ -1371,7 +1369,7 @@ def op(self):
13711369 # type: () -> Optional[str]
13721370 from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
13731371
1374- self ._otel_span .attributes .get (SentrySpanAttribute .OP )
1372+ return self ._otel_span .attributes .get (SentrySpanAttribute .OP )
13751373
13761374 @op .setter
13771375 def op (self , value ):
@@ -1383,13 +1381,18 @@ def op(self, value):
13831381
13841382 @property
13851383 def name (self ):
1386- # type: () -> str
1387- pass
1384+ # type: () -> Optional[str]
1385+ from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
1386+
1387+ return self ._otel_span .attributes .get (SentrySpanAttribute .NAME )
13881388
13891389 @name .setter
13901390 def name (self , value ):
1391- # type: (str) -> None
1392- pass
1391+ # type: (Optional[str]) -> None
1392+ from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
1393+
1394+ if value is not None :
1395+ self ._otel_span .set_attribute (SentrySpanAttribute .NAME , value )
13931396
13941397 @property
13951398 def source (self ):
0 commit comments