@@ -1329,8 +1329,7 @@ def description(self, value):
1329
1329
# type: (Optional[str]) -> None
1330
1330
from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
1331
1331
1332
- if value is not None :
1333
- self .set_attribute (SentrySpanAttribute .DESCRIPTION , value )
1332
+ self .set_attribute (SentrySpanAttribute .DESCRIPTION , value )
1334
1333
1335
1334
@property
1336
1335
def origin (self ):
@@ -1344,8 +1343,7 @@ def origin(self, value):
1344
1343
# type: (Optional[str]) -> None
1345
1344
from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
1346
1345
1347
- if value is not None :
1348
- self .set_attribute (SentrySpanAttribute .ORIGIN , value )
1346
+ self .set_attribute (SentrySpanAttribute .ORIGIN , value )
1349
1347
1350
1348
@property
1351
1349
def containing_transaction (self ):
@@ -1435,8 +1433,7 @@ def op(self, value):
1435
1433
# type: (Optional[str]) -> None
1436
1434
from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
1437
1435
1438
- if value is not None :
1439
- self .set_attribute (SentrySpanAttribute .OP , value )
1436
+ self .set_attribute (SentrySpanAttribute .OP , value )
1440
1437
1441
1438
@property
1442
1439
def name (self ):
@@ -1450,8 +1447,7 @@ def name(self, value):
1450
1447
# type: (Optional[str]) -> None
1451
1448
from sentry_sdk .integrations .opentelemetry .consts import SentrySpanAttribute
1452
1449
1453
- if value is not None :
1454
- self .set_attribute (SentrySpanAttribute .NAME , value )
1450
+ self .set_attribute (SentrySpanAttribute .NAME , value )
1455
1451
1456
1452
@property
1457
1453
def source (self ):
@@ -1573,6 +1569,11 @@ def get_attribute(self, name):
1573
1569
1574
1570
def set_attribute (self , key , value ):
1575
1571
# 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
+
1576
1577
self ._otel_span .set_attribute (key , _serialize_span_attribute (value ))
1577
1578
1578
1579
def set_status (self , status ):
0 commit comments