Skip to content
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

Fix rust tracing #3817

Merged
merged 1 commit into from
Nov 28, 2024
Merged

Fix rust tracing #3817

merged 1 commit into from
Nov 28, 2024

Conversation

sl0thentr0py
Copy link
Member

No description provided.

@sl0thentr0py sl0thentr0py force-pushed the neel/potel/fix-rust-tracing branch from f7a6c1f to 5870c74 Compare November 22, 2024 13:57
sentry_span = parent_sentry_span.start_child(**kwargs)
else:
sentry_span = scope.start_span(**kwargs)
span = sentry_sdk.start_span(
Copy link
Member Author

Choose a reason for hiding this comment

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

@matt-codecov @antonpirker I simplified this part since we don't want users to do scope stuff in integrations, it is anti-patterny

Copy link
Contributor

Choose a reason for hiding this comment

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

from a quick look at the code, it looks like __enter__() will still update the current span and keep track of the parent so that __exit__() can restore it, right? if so then i am fine with this. not qualified to stamp, and also CI is unhappy

Copy link
Member Author

Choose a reason for hiding this comment

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

yes exactly, span management should be done in the core and will just work
ci is unhappy because this is a dev branch

Copy link

codecov bot commented Nov 22, 2024

❌ 922 Tests Failed:

Tests completed Failed Passed Skipped
19684 922 18762 4424
View the top 2 failed tests by shortest run time
tests.integrations.opentelemetry.test_span_processor test_on_start_transaction
Stack Traces | 0.002s run time
.../integrations/opentelemetry/test_span_processor.py:287: in test_on_start_transaction
    with mock.patch(
.../hostedtoolcache/Python/3.12.7....../x64/lib/python3.12/unittest/mock.py:1463: in __enter__
    original, local = self.get_original()
.../hostedtoolcache/Python/3.12.7....../x64/lib/python3.12/unittest/mock.py:1436: in get_original
    raise AttributeError(
E   AttributeError: <module 'sentry_sdk.integrations.opentelemetry.span_processor' from '.../integrations/opentelemetry/span_processor.py'> does not have the attribute 'start_transaction'
tests.integrations.opentelemetry.test_span_processor test_on_start_transaction
Stack Traces | 0.002s run time
.../integrations/opentelemetry/test_span_processor.py:287: in test_on_start_transaction
    with mock.patch(
.../hostedtoolcache/Python/3.10.15....../x64/lib/python3.10/unittest/mock.py:1447: in __enter__
    original, local = self.get_original()
.../hostedtoolcache/Python/3.10.15....../x64/lib/python3.10/unittest/mock.py:1420: in get_original
    raise AttributeError(
E   AttributeError: <module 'sentry_sdk.integrations.opentelemetry.span_processor' from '.../integrations/opentelemetry/span_processor.py'> does not have the attribute 'start_transaction'
View the full list of 1 ❄️ flaky tests
tests.integrations.opentelemetry.test_span_processor test_on_start_transaction

Flake rate in main: 90.70% (Passed 4 times, Failed 39 times)

Stack Traces | 0.001s run time
.../integrations/opentelemetry/test_span_processor.py:289: in test_on_start_transaction
    fake_start_transaction,
.../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1307: in __enter__
    original, local = self.get_original()
.../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1281: in get_original
    "%s does not have the attribute %r" % (target, name)
E   AttributeError: <module 'sentry_sdk.integrations.opentelemetry.span_processor' from '.../integrations/opentelemetry/span_processor.py'> does not have the attribute 'start_transaction'

To view more test analytics, go to the Test Analytics Dashboard
Got feedback? Let us know on Github

@matt-codecov
Copy link
Contributor

PR title says "fix" - is this broken in 2.19?

also why does this need POtelSpan? to be clear, the Rust side of this is not OTEL

@sl0thentr0py
Copy link
Member Author

this is a very large refactor of the SDK to use otel under the hood for the next major. And yes it's fine that the rust side is not otel.

You can ignore all the other stuff tbh, I just pinged you to take a look at the changes because I was changing your integration.

@matt-codecov
Copy link
Contributor

oh interesting

the tracing framework has OTEL integrations in Rust, and there is a different project that actually can attach the Python OTEL context to a Rust function. do you expect that would Just Work and replace the need for this integration entirely?

@sl0thentr0py
Copy link
Member Author

possibly! we can investigate that once we ship this and if it's feature compatible, we can remove it.

Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

lgtm

@sl0thentr0py sl0thentr0py merged commit 59f84d4 into potel-base Nov 28, 2024
49 of 125 checks passed
@sl0thentr0py sl0thentr0py deleted the neel/potel/fix-rust-tracing branch November 28, 2024 12:58
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.

3 participants