Title: Export more utility functions · Issue #7152 · getsentry/sentry-javascript · GitHub
Open Graph Title: Export more utility functions · Issue #7152 · getsentry/sentry-javascript
X Title: Export more utility functions · Issue #7152 · getsentry/sentry-javascript
Description: Problem Statement Currently, in order not to go with sentry.gethub.getscope.getspan and the same for scope all over the application, we use a couple of utility methods: export function setTransactionName(name: string): void { Sentry.getC...
Open Graph Description: Problem Statement Currently, in order not to go with sentry.gethub.getscope.getspan and the same for scope all over the application, we use a couple of utility methods: export function setTransacti...
X Description: Problem Statement Currently, in order not to go with sentry.gethub.getscope.getspan and the same for scope all over the application, we use a couple of utility methods: export function setTransacti...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/7152
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Export more utility functions","articleBody":"### Problem Statement\r\n\r\nCurrently, in order not to go with `sentry.gethub.getscope.getspan` and the same for scope all over the application, we use a couple of utility methods: \r\n```ts\r\nexport function setTransactionName(name: string): void {\r\n Sentry.getCurrentHub().getStack()[0]?.scope?.setTransactionName(name);\r\n}\r\n\r\nexport function dropTransaction() {\r\n Sentry.getCurrentHub().getStack()[0]?.scope?.setTag('dropTransaction', true);\r\n}\r\n\r\nexport function startSpan(\r\n name: string,\r\n spanContext?: Parameters\u003cSentry.Span['startChild']>[0],\r\n pushScope = true\r\n): Sentry.Span | undefined {\r\n const span = Sentry.getCurrentHub()\r\n .getScope()\r\n ?.getSpan()\r\n ?.startChild({\r\n op: name,\r\n ...spanContext,\r\n });\r\n\r\n if (pushScope) {\r\n Sentry.getCurrentHub().pushScope().setSpan(span);\r\n }\r\n\r\n return span;\r\n}\r\n\r\nexport function endSpan(span: Sentry.Span | undefined, popScope = true): void {\r\n if (!span) {\r\n return;\r\n }\r\n\r\n span.finish();\r\n if (popScope) {\r\n Sentry.getCurrentHub().popScope();\r\n }\r\n}\r\n```\t\r\n\r\nespecially the `Sentry.getCurrentHub().getStack()[0]?.scope` part is tricky.\r\n\r\n### Solution Brainstorm\r\n\r\nAre those methods even correct? If they are, the sdk should export something similar itself","author":{"url":"https://github.com/jeengbe","@type":"Person","name":"jeengbe"},"datePublished":"2023-02-12T12:09:21Z","url":"https://github.com/getsentry/sentry-javascript/issues/7152"}
| 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:c2f16e22-71cb-0de3-d45b-e452d54bed04 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EE1C:1EF7B4:4BE291:67C46C:6B049F91 |
| html-safe-nonce | ddd9898b564703926b4c1235645ae07003699289e62c8cc8de539200549e921e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTFDOjFFRjdCNDo0QkUyOTE6NjdDNDZDOjZCMDQ5RjkxIiwidmlzaXRvcl9pZCI6IjgwODkxNTc3NzUyMDIyMzAxNjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 341680ab039e8aacfdf64f481220543a1248669188da291c72a8fe01ded7d781 |
| hovercard-subject-tag | issue:1581234460 |
| 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-javascript/7152/issue_layout |
| twitter:image | https://opengraph.githubassets.com/71b8b88ee5eba97407f5427d3f2147d0bbc662bf606e5564af6f991248e5fffa/getsentry/sentry-javascript/issues/7152 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/71b8b88ee5eba97407f5427d3f2147d0bbc662bf606e5564af6f991248e5fffa/getsentry/sentry-javascript/issues/7152 |
| og:image:alt | Problem Statement Currently, in order not to go with sentry.gethub.getscope.getspan and the same for scope all over the application, we use a couple of utility methods: export function setTransacti... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jeengbe |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9784b6f42e2d5eac4e394fa88cad134c0dc5b6662b4ff2787a1ed1ef5a96331d |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| 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 | 3fd14143b75b2af7b76bbd23b069867d091adfcc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width