Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Commit b0f6b4e

Browse files
feat: Docs for Sentry.span (#781)
Add missing docs for this feature and clarify which span to return depending on global mode. Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
1 parent 52c071b commit b0f6b4e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/docs/sdk/performance/index.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,21 @@ Which in reality is useful for proxies to set it to `0` and opt out of tracing.
219219
## Static API Changes
220220

221221
The `Sentry.startTransaction` function should take two arguments - the `transactionContext` passed to the `Transaction` constructor and an optional `customSamplingContext` object containing data to be passed to `tracesSampler` (if defined).
222-
223222
It creates a `Transaction` bound to the current hub and returns the instance.
224223
Users interact with the instance for creating child spans and, thus, have to
225224
keep track of it themselves.
226225

226+
With `Sentry.span` users can attach spans to an already ongoing transaction.
227+
This property returns a `SpanProtocol` if a running transaction is bound to
228+
the scope; otherwise, it returns nil. Although we recommend users keep track
229+
of their own transactions, the SDKs should offer a way to expose auto-generated
230+
transactions. SDKs shall bind auto-generated transactions to the scope, making
231+
them accessible with `Sentry.span`.
232+
If the SDK has global mode enabled, which specifies whether to use global scope
233+
management mode and should be `true` for client applications and `false` for server
234+
applications, `Sentry.span` shall return the active transaction. If the
235+
user disables global mode, `Sentry.span` shall return the latest active (unfinished) span.
236+
227237
## `Hub` Changes
228238

229239
- Introduce a method called `traceHeaders`

0 commit comments

Comments
 (0)