Title: `start_span` API not as context manager · Issue #3489 · getsentry/sentry-python · GitHub
Open Graph Title: `start_span` API not as context manager · Issue #3489 · getsentry/sentry-python
X Title: `start_span` API not as context manager · Issue #3489 · getsentry/sentry-python
Description: Problem Before POTel, you could do: span = start_span(...) sentry_sdk.get_current_scope().span = span # forgot this initially, in case you're confused by the comments # do stuff span.finish() i.e., start and finish a span without using a...
Open Graph Description: Problem Before POTel, you could do: span = start_span(...) sentry_sdk.get_current_scope().span = span # forgot this initially, in case you're confused by the comments # do stuff span.finish() i.e.,...
X Description: Problem Before POTel, you could do: span = start_span(...) sentry_sdk.get_current_scope().span = span # forgot this initially, in case you're confused by the comments # do stuff span.finish() i...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/3489
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`start_span` API not as context manager","articleBody":"## Problem\n\nBefore POTel, you could do:\n\n```python\nspan = start_span(...)\nsentry_sdk.get_current_scope().span = span # forgot this initially, in case you're confused by the comments\n# do stuff\nspan.finish()\n```\n\ni.e., start and finish a span without using a context manager.\n\nWith the current POTel design, this would create an inactive span (not attached to the current span as a child span) because the context attach/detach happens in `__enter__` and `__exit__`, respectively.\n\nThis might break a lot of setups -> we should find a way to still support this, while also giving people the possibility to create inactive spans.\n\n(Same for `start_transaction`.)\n\n## Solution\n\n* make the code snippet above work in POTel to not break users (i.e., implement the `scope.span` setter) and deprecate it\n* add a `span.activate()` method that is a user-friendly equivalent of setting the span on the scope","author":{"url":"https://github.com/sentrivana","@type":"Person","name":"sentrivana"},"datePublished":"2024-09-02T11:47:27Z","url":"https://github.com/getsentry/sentry-python/issues/3489"}
| 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:ea43b64a-4902-829e-6b50-0fca8b12d20b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B798:E0D08:C3039:102D58:6B00B9C7 |
| html-safe-nonce | 0d26f31bc3c0479503fe18ed91256afae2c837648db0c27ea10fd71f6033ecb2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzk4OkUwRDA4OkMzMDM5OjEwMkQ1ODo2QjAwQjlDNyIsInZpc2l0b3JfaWQiOiIzNDEyODE5NTQ5NjQzMzg5MzgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 57efca16f8cad294a144d02be2fdf4206780e956db06735bc681bf9526bde5d0 |
| hovercard-subject-tag | issue:2500760466 |
| 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/3489/issue_layout |
| twitter:image | https://opengraph.githubassets.com/87ab019d837ed90999d47a9950cb50f83efdd4c6a97c6f73e74c66b28dcb9034/getsentry/sentry-python/issues/3489 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/87ab019d837ed90999d47a9950cb50f83efdd4c6a97c6f73e74c66b28dcb9034/getsentry/sentry-python/issues/3489 |
| og:image:alt | Problem Before POTel, you could do: span = start_span(...) sentry_sdk.get_current_scope().span = span # forgot this initially, in case you're confused by the comments # do stuff span.finish() i.e.,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sentrivana |
| 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