Ensure span is properly ended when object is destroyed.
(self)
| 66 | super().__init__(*args, **kwargs) |
| 67 | |
| 68 | def __del__(self): |
| 69 | """Ensure span is properly ended when object is destroyed.""" |
| 70 | if hasattr(self, "_agentops_span_context_manager") and self._agentops_span_context_manager: |
| 71 | try: |
| 72 | self._agentops_span_context_manager.__exit__(None, None, None) |
| 73 | except Exception: |
| 74 | pass |
| 75 | |
| 76 | async def __aenter__(self) -> "WrappedClass": |
| 77 | if hasattr(self, "_agentops_active_span") and self._agentops_active_span is not None: |