Skip to content

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.

@rhcarvalho rhcarvalho force-pushed the rhcarvalho/scope-get-transaction branch 2 times, most recently from 4ba20b8 to 8839f99 Compare June 25, 2020 13:10
@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
@rhcarvalho rhcarvalho requested a review from untitaker June 25, 2020 20:27
# type: (Any) -> None
# would be type: (Optional[str]) -> None, see https://github.com/python/mypy/issues/3004
"""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.

2 participants