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

feat: Access transaction in current scope #734

Merged
merged 1 commit into from Jun 26, 2020

Conversation

rhcarvalho
Copy link
Contributor

Specially when trying to add spans to automatically instrumented transactions, users need access to the current transaction.

This gives direct access no matter how deep the code is in the transaction/span tree.

This replicates a similar feature in JS: getsentry/sentry-javascript#2668.

sentry_sdk/scope.py Outdated Show resolved Hide resolved
@rhcarvalho
Copy link
Contributor Author

Dang, the current implementation runs into a MYPY limitation because the type annotation for property getter and setter is different.

python/mypy#3004

https://travis-ci.com/github/getsentry/sentry-python/builds/173008390

@rhcarvalho rhcarvalho force-pushed the rhcarvalho/scope-get-transaction branch from 8839f99 to c2d1797 Compare June 25, 2020 15:40
Specially when trying to add spans to automatically instrumented
transactions, users need access to the current transaction.

This gives direct access no matter how deep the code is in the
transaction/span tree.
@rhcarvalho rhcarvalho force-pushed the rhcarvalho/scope-get-transaction branch from c2d1797 to d4539e1 Compare June 25, 2020 19:49
@rhcarvalho rhcarvalho marked this pull request as ready for review June 25, 2020 20:26
"""When set this forces a specific transaction name to be set."""
# XXX: the docstring above is misleading. The implementation of
Copy link
Member

Choose a reason for hiding this comment

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

Feel free to fix that behavior in this PR, I don't think anybody would notice even.

@rhcarvalho rhcarvalho merged commit 8c35da5 into master Jun 26, 2020
@rhcarvalho rhcarvalho deleted the rhcarvalho/scope-get-transaction branch June 26, 2020 09:59
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.

None yet

2 participants