File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -1268,7 +1268,7 @@ def __enter__(self):
1268
1268
1269
1269
def __exit__ (self , ty , value , tb ):
1270
1270
# type: (Optional[Any], Optional[Any], Optional[Any]) -> None
1271
- self ._otel_span . end ()
1271
+ self .finish ()
1272
1272
# XXX set status to error if unset and an exception occurred?
1273
1273
context .detach (self ._ctx_token )
1274
1274
@@ -1524,9 +1524,16 @@ def is_success(self):
1524
1524
# type: () -> bool
1525
1525
return self ._otel_span .status .code == StatusCode .OK
1526
1526
1527
- def finish (self , scope = None , end_timestamp = None ):
1528
- # type: (Optional[sentry_sdk.Scope], Optional[Union[float, datetime]]) -> Optional[str]
1529
- pass
1527
+ def finish (self , end_timestamp = None ):
1528
+ # type: (Optional[Union[float, datetime]]) -> Optional[str]
1529
+ if end_timestamp is not None :
1530
+ from sentry_sdk .integrations .opentelemetry .utils import (
1531
+ convert_to_otel_timestamp ,
1532
+ )
1533
+
1534
+ self ._otel_span .end (convert_to_otel_timestamp (end_timestamp ))
1535
+ else :
1536
+ self ._otel_span .end ()
1530
1537
1531
1538
def to_json (self ):
1532
1539
# type: () -> dict[str, Any]
You can’t perform that action at this time.
0 commit comments