Title: Span should support async context manager protocol · Issue #2007 · getsentry/sentry-python · GitHub
Open Graph Title: Span should support async context manager protocol · Issue #2007 · getsentry/sentry-python
X Title: Span should support async context manager protocol · Issue #2007 · getsentry/sentry-python
Description: Problem Statement Span and Transaction should support async context manager protocol to avoid unnecessary nesting. As an example: async def main() -> None: async with a: with sentry_sdk.start_transaction( op="op", name="name", ): with se...
Open Graph Description: Problem Statement Span and Transaction should support async context manager protocol to avoid unnecessary nesting. As an example: async def main() -> None: async with a: with sentry_sdk.start_trans...
X Description: Problem Statement Span and Transaction should support async context manager protocol to avoid unnecessary nesting. As an example: async def main() -> None: async with a: with sentry_sdk.start_tr...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/2007
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Span should support async context manager protocol","articleBody":"### Problem Statement\n\n`Span` and `Transaction` should support async context manager protocol to avoid unnecessary nesting.\r\n\r\nAs an example:\r\n```py\r\nasync def main() -> None:\r\n async with a:\r\n with sentry_sdk.start_transaction(\r\n op=\"op\",\r\n name=\"name\",\r\n ):\r\n with sentry_sdk.start_span(op=\"b\"):\r\n async with b:\r\n await b.run()\r\n\r\n with sentry_sdk.start_span(op=\"c\"):\r\n async with c:\r\n await c.run()\r\n```\r\n\r\nCould be shortened to\r\n```py\r\nasync def main() -> None:\r\n async with a, sentry_sdk.start_transaction(\r\n op=\"op\",\r\n name=\"name\",\r\n ):\r\n async with sentry_sdk.start_span(op=\"b\"), b:\r\n await b.run()\r\n\r\n async with sentry_sdk.start_span(op=\"c\"), c:\r\n await c.run()\r\n```\n\n### Solution Brainstorm\n\nI think currently `__aenter__` and `__aexit__` could do the same as their synchronous counterparts and later could be replaced with async code, if that would be possible at some point 🤔 ","author":{"url":"https://github.com/notypecheck","@type":"Person","name":"notypecheck"},"datePublished":"2023-04-12T11:31:21Z","url":"https://github.com/getsentry/sentry-python/issues/2007"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f3fd2e79-3e13-44bb-d959-7a4304d13369 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C27A:3FF2FE:CD8CB7:11B17C9:6B00B4EA |
| html-safe-nonce | f6d6ffe55fdeada2edfab831047fa8e5771fc797e5689b6885dab3ff622427bd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjdBOjNGRjJGRTpDRDhDQjc6MTFCMTdDOTo2QjAwQjRFQSIsInZpc2l0b3JfaWQiOiI4MzMzOTE3Mjk2OTk3MjE3NTE0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 72bba7412b92371d87c874d79fb6a66444e28f7b902045261ea629f011c0e141 |
| hovercard-subject-tag | issue:1664382756 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-python/2007/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0df24207558f4764de7ff48165a266bf42e2546515622a5e23090accfab92c91/getsentry/sentry-python/issues/2007 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0df24207558f4764de7ff48165a266bf42e2546515622a5e23090accfab92c91/getsentry/sentry-python/issues/2007 |
| og:image:alt | Problem Statement Span and Transaction should support async context manager protocol to avoid unnecessary nesting. As an example: async def main() -> None: async with a: with sentry_sdk.start_trans... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | notypecheck |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1d07c25977adfc5ff6acb0a962a9bc168c07afbda6fef765f9761c350c2ae4a2 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 137814779 |
| octolytics-dimension-repository_nwo | getsentry/sentry-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 137814779 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5429cbfc6aca8c7b9a086a3c8f47400346f38cc9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width