|
| 1 | +import logging |
1 | 2 | import os
|
2 | 3 | import sys
|
3 | 4 | import warnings
|
|
9 | 10 | from functools import wraps
|
10 | 11 | from itertools import chain
|
11 | 12 |
|
| 13 | +from sentry_sdk._types import AnnotatedValue |
12 | 14 | from sentry_sdk.attachments import Attachment
|
13 | 15 | from sentry_sdk.consts import DEFAULT_MAX_BREADCRUMBS, FALSE_VALUES, INSTRUMENTER
|
14 | 16 | from sentry_sdk.feature_flags import FlagBuffer, DEFAULT_FLAG_CAPACITY
|
|
33 | 35 | Transaction,
|
34 | 36 | )
|
35 | 37 | from sentry_sdk.utils import (
|
36 |
| - AnnotatedDeque, |
37 | 38 | capture_internal_exception,
|
38 | 39 | capture_internal_exceptions,
|
39 | 40 | ContextVar,
|
@@ -987,8 +988,14 @@ def add_breadcrumb(self, crumb=None, hint=None, **kwargs):
|
987 | 988 | logger.info("before breadcrumb dropped breadcrumb (%s)", crumb)
|
988 | 989 |
|
989 | 990 | while len(self._breadcrumbs) > max_breadcrumbs:
|
| 991 | + logging.debug( |
| 992 | + f"i am here in the truncation logic before, {self._n_breadcrumbs_truncated}" |
| 993 | + ) |
990 | 994 | self._breadcrumbs.popleft()
|
991 | 995 | self._n_breadcrumbs_truncated += 1
|
| 996 | + logging.debug( |
| 997 | + f"i am here in the truncation logic after, {self._n_breadcrumbs_truncated}" |
| 998 | + ) |
992 | 999 |
|
993 | 1000 | def start_transaction(
|
994 | 1001 | self,
|
@@ -1388,12 +1395,19 @@ def _apply_breadcrumbs_to_event(self, event, hint, options):
|
1388 | 1395 | pass
|
1389 | 1396 |
|
1390 | 1397 | # Add annotation that breadcrumbs were truncated
|
| 1398 | + logging.debug( |
| 1399 | + f"i am here outside of the truncated thing, {self._n_breadcrumbs_truncated} and {len(self._breadcrumbs)}" |
| 1400 | + ) |
1391 | 1401 | if self._n_breadcrumbs_truncated:
|
| 1402 | + logging.debug("i am here in the truncated thing") |
1392 | 1403 | original_length = (
|
1393 | 1404 | len(event["breadcrumbs"]["values"]) + self._n_breadcrumbs_truncated
|
1394 | 1405 | )
|
1395 |
| - event["breadcrumbs"]["values"] = AnnotatedDeque.truncated_breadcrumbs( |
1396 |
| - event["breadcrumbs"]["values"], original_length |
| 1406 | + logging.debug( |
| 1407 | + f"in the truncated thing, the original_lenght is {original_length}" |
| 1408 | + ) |
| 1409 | + event["breadcrumbs"] = AnnotatedValue( |
| 1410 | + event.get("breadcrumbs", []), {"len": original_length} |
1397 | 1411 | )
|
1398 | 1412 |
|
1399 | 1413 | def _apply_user_to_event(self, event, hint, options):
|
@@ -1546,6 +1560,9 @@ def apply_to_event(
|
1546 | 1560 |
|
1547 | 1561 | if not is_transaction and not is_check_in:
|
1548 | 1562 | self._apply_breadcrumbs_to_event(event, hint, options)
|
| 1563 | + # logging.debug(event) |
| 1564 | + logging.debug(event["breadcrumbs"]) |
| 1565 | + logging.debug(type(event["breadcrumbs"])) |
1549 | 1566 | self._apply_flags_to_event(event, hint, options)
|
1550 | 1567 |
|
1551 | 1568 | event = self.run_error_processors(event, hint)
|
@@ -1579,6 +1596,10 @@ def update_from_scope(self, scope):
|
1579 | 1596 | self._extras.update(scope._extras)
|
1580 | 1597 | if scope._breadcrumbs:
|
1581 | 1598 | self._breadcrumbs.extend(scope._breadcrumbs)
|
| 1599 | + if scope._n_breadcrumbs_truncated: |
| 1600 | + self._n_breadcrumbs_truncated = ( |
| 1601 | + self._n_breadcrumbs_truncated + scope._n_breadcrumbs_truncated |
| 1602 | + ) |
1582 | 1603 | if scope._span:
|
1583 | 1604 | self._span = scope._span
|
1584 | 1605 | if scope._attachments:
|
|
0 commit comments