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

Codecov Results 📊

111388 passed | ⏭️ 6749 skipped | Total: 118137 | Pass Rate: 94.29% | Execution Time: 399m 23s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +33
Passed Tests 📈 +33
Failed Tests
Skipped Tests

All tests are passing successfully.

✅ Patch coverage is 92.86%. Project has 2484 uncovered lines.
✅ Project coverage is 90.19%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/client.py 85.71% ⚠️ 1 Missing and 1 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    90.17%    90.19%    +0.02%
==========================================
  Files          193       193         —
  Lines        25317     25309        -8
  Branches      9280      9272        -8
==========================================
+ Hits         22827     22825        -2
- Misses        2490      2484        -6
- Partials      1427      1428        +1

Generated by Codecov Action

@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