github getsentry/sentry-python 2.68.0

4 hours ago

Important

  • We're making enable_logs and enable_metrics no-op with this release (#7177), and they'll be dropped in the next major.

    Previously, enable_logs also controlled automatic logs collection from the logging and Loguru integrations. These integrations now get an integration-level capture_sentry_logs boolean option to allow for more control over the auto-collection. These options are False by default, i.e., nothing is auto-collected without your explicit opt-in.

    Action Needed

    If you had enable_logs set to True:

    • If you were using the sentry_sdk.logger.X API, no action necessary, the API will just work.
    • If you were auto-collecting logs from either LoggingIntegration or LoguruIntegration, the auto-collection will be turned off in this release. You can switch auto-collection on explicitly with:
    import sentry_sdk
    from sentry_sdk.integrations.logging import LoggingIntegration
    from sentry_sdk.integrations.loguru import LoguruIntegration
    
    sentry_sdk.init(
        integrations=[
            LoggingIntegration(capture_sentry_logs=True),
            LoguruIntegration(capture_sentry_logs=True),
        ],
    )

    If you had enable_logs set to False:

    • If you were using it to gate usages of the sentry_sdk.logger.X API, you'll need to remove the calls entirely or define a before_send_log callback to filter out unwanted logs.

    If you has enable_metrics set to False:

    • Any metrics emitted using the metrics API will be emitted. You'll need to drop them in a before_send_metric or remove the calls to the API.

    Why We're Doing This

    We recognize this is a disruptive change for some folks and want to make it clear this is a one-off. We're removing the options because they were an unnecessary hurdle that one had to jump through to be able to use logs and metrics, and it was confusing why the logging API would not just work on its own. On the other hand, we wanted to give you more fine-grained control over automatic collection.

New Features ✨

Other

Bug Fixes 🐛

Internal Changes 🔧

HTTPX, HTTPX2

Other

Don't miss a new sentry-python release

NewReleases is sending notifications on new releases.