8000 fix(tracing): Fix span nesting concurrency issues by szokeasaurusrex · Pull Request #4409 · getsentry/sentry-python · GitHub
[go: up one dir, main page]

Skip to content

fix(tracing): Fix span nesting concurrency issues #4409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

szokeasaurusrex
Copy link
Member

Fixes #4241


Thank you for contributing to sentry-python! Please add tests to validate your changes, and lint your code using tox -e linters.

Running the test suite on your PR might require maintainer approval.

Copy link
codecov bot commented May 20, 2025

⚠️ Parser warning

The parser emitted a warning. Please review your JUnit XML file:

Warning while parsing testcase attributes: Limit of string is 1000 chars, for name, we got 2301 at 1:2560 in /home/runner/work/sentry-python/sentry-python/.junitxml

❌ 64 Tests Failed:

Tests completed Failed Passed Skipped
23935 64 23871 5876
View the top 3 failed test(s) by shortest run time
tests.integrations.clickhouse_driver.test_clickhouse_driver::test_clickhouse_client_breadcrumbs_with_pii
Stack Traces | 0s run time
tests/conftest.py:93: in _
    reraise(*e)
sentry_sdk/utils.py:1746: in reraise
    raise value
sentry_sdk/integrations/clickhouse_driver.py:120: in _inner_end
    span.scope.add_breadcrumb(
E   AttributeError: 'NoneType' object has no attribute 'add_breadcrumb'
tests.integrations.clickhouse_driver.test_clickhouse_driver::test_clickhouse_dbapi_breadcrumbs
Stack Traces | 0s run time
tests/conftest.py:93: in _
    reraise(*e)
sentry_sdk/utils.py:1746: in reraise
    raise value
sentry_sdk/integrations/clickhouse_driver.py:120: in _inner_end
    span.scope.add_breadcrumb(
E   AttributeError: 'NoneType' object has no attribute 'add_breadcrumb'
tests.integrations.langchain.test_langchain::test_langchain_agent[False-True-False]
Stack Traces | 0s run time
tests/conftest.py:93: in _
    reraise(*e)
sentry_sdk/utils.py:1746: in reraise
    raise value
sentry_sdk/integrations/langchain.py:332: in on_chain_end
    self._exit_span(span_data, run_id)
sentry_sdk/integrations/langchain.py:164: in _exit_span
    span_data.span.__exit__(None, None, None)
sentry_sdk/tracing.py:408: in __exit__
    self.scope_manager.__exit__(ty, value, tb)
.../hostedtoolcache/Python/3.12.10.../x64/lib/python3.12/contextlib.py:144: in __exit__
    next(self.gen)
sentry_sdk/scope.py:1681: in new_scope
    _current_scope.reset(token)
E   ValueError: <Token var=<ContextVar name='current_scope' default=None at 0x7fa99bd437e0> at 0x7fa98a32dec0> was created in a different Context

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.

Using @sentry_sdk.trace with concurrent futures messes up span hierarchy
1 participant
0