@@ -1329,8 +1329,7 @@ def description(self, value):
13291329 # type: (Optional[str]) -> None
13301330 from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
13311331
1332- if value is not None :
1333- self .set_attribute (SentrySpanAttribute .DESCRIPTION , value )
1332+ self .set_attribute (SentrySpanAttribute .DESCRIPTION , value )
13341333
13351334 @property
13361335 def origin (self ):
@@ -1344,8 +1343,7 @@ def origin(self, value):
13441343 # type: (Optional[str]) -> None
13451344 from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
13461345
1347- if value is not None :
1348- self .set_attribute (SentrySpanAttribute .ORIGIN , value )
1346+ self .set_attribute (SentrySpanAttribute .ORIGIN , value )
13491347
13501348 @property
13511349 def containing_transaction (self ):
@@ -1435,8 +1433,7 @@ def op(self, value):
14351433 # type: (Optional[str]) -> None
14361434 from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
14371435
1438- if value is not None :
1439- self .set_attribute (SentrySpanAttribute .OP , value )
1436+ self .set_attribute (SentrySpanAttribute .OP , value )
14401437
14411438 @property
14421439 def name (self ):
@@ -1450,8 +1447,7 @@ def name(self, value):
14501447 # type: (Optional[str]) -> None
14511448 from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
14521449
1453- if value is not None :
1454- self .set_attribute (SentrySpanAttribute .NAME , value )
1450+ self .set_attribute (SentrySpanAttribute .NAME , value )
14551451
14561452 @property
14571453 def source (self ):
@@ -1573,6 +1569,11 @@ def get_attribute(self, name):
15731569
15741570 def set_attribute (self , key , value ):
15751571 # type: (str, Any) -> None
1572+ if value is None :
1573+ # otel doesn't support None as values, preferring to not set the key
1574+ # at all instead
1575+ return
1576+
15761577 self ._otel_span .set_attribute (key , _serialize_span_attribute (value ))
15771578
15781579 def set_status (self , status ):
0 commit comments