Sentry Python SDK 3.0

The Sentry Python SDK 3.x works with Bugsink. When upgrading from 2.x, keep your existing DSN and update the SDK configuration: some initialization options were removed, logging is now opt-in, and data collection defaults changed.

Initialization

If you copied Bugsink’s earlier Python setup example, remove send_default_pii=True. The other options in that example still work.

This configuration also restores the logging error events that SDK 2.x captured by default:

import logging
import os
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration

sentry_sdk.init(
    dsn=os.environ["SENTRY_DSN"],
    integrations=[
        LoggingIntegration(
            level=None,
            event_level=logging.ERROR,
            breadcrumb_level=logging.INFO,
        ),
    ],
    traces_sample_rate=0,
    send_client_reports=False,
    auto_session_tracking=False,
)

Use the DSN from your Bugsink project. If your application does not use Python logging, omit integrations and the two logging imports. Explicit capture_exception() calls and automatic exception capture do not depend on the logging integration.

Install the base sentry-sdk package. Removed extras such as [django] and [fastapi] are no longer needed; their removal does not remove the framework integrations.

Logging changes

Enabling the integration alone does not restore logging errors. In 3.x, LoggingIntegration() defaults to creating no error events. The three levels in the example control different outputs:

  • event_level sends ERROR and CRITICAL records as events, which appear as issues in Bugsink.
  • breadcrumb_level attaches INFO and higher records as context on subsequent events.
  • level controls Sentry’s separate log stream. Set it to None because Bugsink does not process that stream.

In 2.x, level controlled breadcrumbs. If you already configured the integration, move that threshold to breadcrumb_level and set event_level explicitly. Loguru also needs an explicit LoguruIntegration with an event_level; it is no longer enabled automatically.

Data collection

SDK 3.x replaces send_default_pii with data_collection. The new defaults collect user information and HTTP bodies, so removing send_default_pii=False changes what you send. Review the categories your application uses before upgrading.

Local variables also changed: the SDK no longer scrubs sensitive variable names by default. For example, to disable user information and HTTP bodies while keeping local variables with the built-in denylist, add this argument to init():

data_collection={
    "user_info": False,
    "http_bodies": [],
    "stack_frame_variables": {"mode": "denylist"},
},

To stop collecting variables altogether, set stack_frame_variables to False. The old include_local_variables option was removed. To disable source context, replace include_source_context=False by setting frame_context_lines to 0 inside data_collection.

Headers, cookies, query parameters, and other integration data have their own collection rules. The example handles three categories; it does not reproduce all of 2.x’s send_default_pii=False behavior.

Other removed APIs

Old initialization arguments raise TypeError: Unknown option. For a Bugsink configuration, remove enable_logs, enable_tracing, profiles_sample_rate, and before_send_transaction. Keep traces_sample_rate=0 and use before_send to filter error events.

If you used EventScrubber, remove its import from sentry_sdk.scrubber and the event_scrubber argument. Use data_collection for collection rules and before_send for custom event scrubbing.

Scopes and transactions

Use sentry_sdk.new_scope() in place of push_scope(). Replace configure_scope() with get_current_scope(), without a with block. The deprecated Hub API was removed too.

start_transaction() was removed along with transaction-based tracing. Remove tracing code from Bugsink-only instrumentation. If you send traces elsewhere, migrate that instrumentation to the SDK’s span API separately.

Check error delivery

After initialization, run this in your application:

try:
    raise ValueError("Checkout exception")
except ValueError:
    sentry_sdk.capture_exception()

sentry_sdk.flush(timeout=10)

Find ValueError: Checkout exception in your Bugsink project’s issue list. For a short-lived script, flush() waits for pending sends before exit.

Limitations

Bugsink processes error events; it does not display Sentry’s streamed spans, profiles, or structured log stream. These checks cover explicit exception and message capture, standard library logging, and Loguru, rather than every framework integration.

Tested with Python 3.12, SDK 3.0.0 and 3.0.1, and Bugsink 2.7.1 on November 27, 2026.