Skip to content

Commit 573b989

Browse files
committed
Merge branch 'master' into shellmayr/feat/langgraph-integration
2 parents fa7aba3 + 6d6e8a2 commit 573b989

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

sentry_sdk/profiler/transaction_profiler.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
)
4646
from sentry_sdk.utils import (
4747
capture_internal_exception,
48+
capture_internal_exceptions,
4849
get_current_thread_meta,
4950
is_gevent,
5051
is_valid_sample_rate,
@@ -369,12 +370,13 @@ def __enter__(self):
369370

370371
def __exit__(self, ty, value, tb):
371372
# type: (Optional[Any], Optional[Any], Optional[Any]) -> None
372-
self.stop()
373+
with capture_internal_exceptions():
374+
self.stop()
373375

374-
scope, old_profile = self._context_manager_state
375-
del self._context_manager_state
376+
scope, old_profile = self._context_manager_state
377+
del self._context_manager_state
376378

377-
scope.profile = old_profile
379+
scope.profile = old_profile
378380

379381
def write(self, ts, sample):
380382
# type: (int, ExtractedSample) -> None

sentry_sdk/tracing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from sentry_sdk.consts import INSTRUMENTER, SPANSTATUS, SPANDATA, SPANTEMPLATE
99
from sentry_sdk.profiler.continuous_profiler import get_profiler_id
1010
from sentry_sdk.utils import (
11+
capture_internal_exceptions,
1112
get_current_thread_meta,
1213
is_valid_sample_rate,
1314
logger,
@@ -418,10 +419,11 @@ def __exit__(self, ty, value, tb):
418419
if value is not None and should_be_treated_as_error(ty, value):
419420
self.set_status(SPANSTATUS.INTERNAL_ERROR)
420421

421-
scope, old_span = self._context_manager_state
422-
del self._context_manager_state
423-
self.finish(scope)
424-
scope.span = old_span
422+
with capture_internal_exceptions():
423+
scope, old_span = self._context_manager_state
424+
del self._context_manager_state
425+
self.finish(scope)
426+
scope.span = old_span
425427

426428
@property
427429
def containing_transaction(self):

0 commit comments

Comments
 (0)