You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(js): Add documentation for setActiveSpanInBrowser(span: Span) (#15007)
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Adds documentation for `Sentry. setActiveSpanInBrowser(span)` which is
added via getsentry/sentry-javascript#17714. To
be merged only after the feature was released. This is still based on
#15006 because I need the `availableSince` prop on the `SdkApi`
component.
closes https://linear.app/getsentry/issue/FE-608/docs-for-setspanactive
## IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [ ] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## LEGAL BOILERPLATE
<!-- Sentry employees and contractors can delete or ignore this section.
-->
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
---------
Co-authored-by: Shannon Anahata <shannon.anahata@gmail.com>
Copy file name to clipboardExpand all lines: docs/platforms/javascript/common/tracing/instrumentation/index.mdx
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,8 +102,46 @@ Sometimes, you do not want the span to be ended automatically when the callback
102
102
103
103
To add spans that aren't active, you can create independent spans. This is useful when you have work that is grouped together under a single parent span, but is independent from the currently active span. However, in most cases you'll want to create and use the [startSpan](#starting-an-active-span-startspan) API from above.
// Ending the span automatically removes it as the active span
130
+
checkoutSpan.end();
131
+
})
132
+
```
133
+
134
+
Using `startInactiveSpan` in combination with `setActiveSpanInBrowser` allows you to create an inactive span that can be made active until you manually end it. In contrast, [`startSpanManual`](#starting-an-active-span-with-manual-end-startspanmanual) allows you to end the span manually at any point, but it only remains active within the callback.
135
+
136
+
<Alert>
137
+
138
+
Note that `setActiveSpanInBrowser` is only available in browser environments! If you're running code in the server
139
+
(for example for server-side rendering), make sure to guard this call to only run in the browser.
140
+
141
+
</Alert>
142
+
143
+
</PlatformCategorySection>
144
+
107
145
## Starting Spans as Children of a Specific Span
108
146
109
147
By default, any span that is started will be the child of the currently active span. If you want to have a different behavior, you can force spans to be the children of a specific span with the `parentSpan` option:
0 commit comments