chore: Make `enable_logs`, `enable_metrics` no-op by sentrivana · Pull Request #7177 · getsentry/sentry-python · GitHub
Skip to content

chore: Make enable_logs, enable_metrics no-op - #7177

Merged
sentrivana merged 5 commits into
masterfrom
ivana/rewire-enable-logs
Aug 12, 2026
Merged

chore: Make enable_logs, enable_metrics no-op#7177
sentrivana merged 5 commits into
masterfrom
ivana/rewire-enable-logs

Conversation

@sentrivana

@sentrivana sentrivana commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

We're making enable_logs and enable_metrics no-op with this change, and they'll be dropped in the next major.

There's no need for an additional hurdle for using the logs and metrics APIs -- opting to use the API is opt-in enough.

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.

If you want to enable auto-collection, do:

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),
    ]
)

Issues

Closes #6195

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@sentrivana
sentrivana marked this pull request as ready for review August 12, 2026 11:49
@sentrivana
sentrivana requested a review from a team as a code owner August 12, 2026 11:49

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ae82dd5. Configure here.

Comment thread sentry_sdk/client.py
Comment thread tests/integrations/logging/test_logging.py
@sentrivana
sentrivana merged commit 2fef9bc into master Aug 12, 2026
139 checks passed
@sentrivana
sentrivana deleted the ivana/rewire-enable-logs branch August 12, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable logging by default [Python]

2 participants