Skip to content

fix: make telemetry initialization non-fatal - #749

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/telemetry-init-robustness
Open

fix: make telemetry initialization non-fatal#749
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/telemetry-init-robustness

Conversation

@sentry

@sentry sentry Bot commented Aug 2, 2026

Copy link
Copy Markdown

This PR addresses the AttributeError: module 'sentry_sdk' has no attribute 'get_current_hub' issue by making the telemetry initialization process non-fatal.

Root Cause: The original issue stemmed from older CLI versions (specifically cli@10.0.1) where the opentelemetry.py module included an OpenTelemetry integration that internally called sentry_sdk.get_current_hub(). This function was part of the Sentry SDK 1.x Hub API and was removed in Sentry SDK 2.x, which cli@10.0.1 was configured to use. This mismatch caused the AttributeError and crashed the CLI.

Previous Fix: The OpenTelemetry integration, including the problematic SentrySpanProcessor and SentryPropagator imports, was removed from codecov_cli/opentelemetry.py in commit dca7a65 on Jan 21, 2025. This means that CLI versions released after this date no longer contain the code that directly causes this AttributeError.

Current Change: While the underlying bug is resolved in newer CLI versions, this PR adds a defensive try-except block around the init_telem(ctx.obj) call in codecov_cli/main.py. This ensures that if any future Sentry SDK incompatibility or other issue arises during telemetry initialization, it will be caught, logged at a debug level, and will not prevent the CLI from executing its core functionality.

Impact: This change improves the robustness of the CLI. Users running older, affected versions (like cli@10.0.1) are strongly encouraged to upgrade to the latest CLI version to benefit from both the original fix and this added layer of stability.

Fixes CLI-FV

@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
723 1 722 1
View the full list of 1 ❄️ flaky test(s)
api.temp.calculator.test_calculator::test_divide

Flake rate in main: 100.00% (Passed 0 times, Failed 1625 times)

Stack Traces | 0.001s run time
def
                test_divide():
                > assert Calculator.divide(1, 2) == 0.5
                E assert 1.0 == 0.5
                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)
                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide
                .../temp/calculator/test_calculator.py:30: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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.

0 participants