Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
- We changed the way we emit warnings. Deprecations will from now on be always emitted using `warnings.warn()`, while all other warnings will be emitted using `logger.warning()`.
- `sentry_sdk.init()` can no longer be used as a context manager.
- The `@trace` decorator doesn't accept a `template` parameter anymore.
- The option `attach_stacktrace` is now `True` by default, meaning the SDK will attach stack traces to messages.

### Logging

Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ def __init__(
before_send: "Optional[EventProcessor]" = None,
before_breadcrumb: "Optional[BreadcrumbProcessor]" = None,
debug: "Optional[bool]" = None,
attach_stacktrace: bool = False,
attach_stacktrace: bool = True,
ca_certs: "Optional[str]" = None,
traces_sample_rate: "Optional[float]" = None,
traces_sampler: "Optional[TracesSampler]" = None,
Expand Down
5 changes: 1 addition & 4 deletions tests/integrations/logging/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ def test_logging_defaults(sentry_init, capture_events):

sentry_sdk.flush()

for event in events:
print(event)
print()

# Without adding the integration explicitly, only the message should be
# captured (no logs), and it shouldn't have any breadcrumbs
assert len(events) == 1
Expand Down Expand Up @@ -160,6 +156,7 @@ def test_event_logging_stack_trace(
integrations=[
LoggingIntegration(breadcrumb_level=logging.INFO, event_level=logging.ERROR)
],
attach_stacktrace=False,
)
events = capture_events()

Expand Down
19 changes: 19 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,25 @@ def bar():
assert functions == ["foo", "bar"]


def test_attach_stacktrace_default(sentry_init, capture_events):
sentry_init()
events = capture_events()

def foo():
bar()

def bar():
capture_message("HI")

foo()

(event,) = events
(thread,) = event["threads"]["values"]
functions = [x["function"] for x in thread["stacktrace"]["frames"]]

assert functions[-2:] == ["foo", "bar"]


def test_attach_stacktrace_enabled(sentry_init, capture_events):
sentry_init(attach_stacktrace=True)
events = capture_events()
Expand Down
Loading