Skip to content

Commit b760c5d

Browse files
committed
add a paragraph around SDKs with single scopes
1 parent 8aeeaa4 commit b760c5d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

text/0101-revamping-the-sdk-performance-api.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ In the ideal case, `startActiveSpan` should generally follow this code path.
145145
146146
If the provided callback throws an exception, the span/transaction created in step 2 should be marked as errored. This error should not be swallowed by `startActiveSpan`.
147147
148+
`startActiveSpan` only provides the correct parent-child relationship if your platform has proper support for forking scopes. For platforms have a single hub/scope (like the mobile SDKs), this method will not lead to the correct parent-child relationship. The SDK will have to provide a different method for these platforms. One option is for `startActiveSpan` to always attach the span it creates to the root span (the transaction), which means users don't get exact parent-child relationships, but they do get relative relationships between spans using relative durations.
149+
148150
`Sentry.startSpan` will create a span, but not set it as the active span in the current scope.
149151
150152
```ts
@@ -168,11 +170,7 @@ For example with go:
168170
sentry.StartSpanFromContext(ctx, spanCtx)
169171
```
170172
171-
Or when continuing from headers in javascript:
172-
173-
```js
174-
Sentry.startSpanFromHeaders(spanCtx, headers);
175-
```
173+
Other SDKs can also add a `startSpanFromContext` method where they can make context a variable databag that accepts headers, environment variables, etc. This is useful for easy trace propagation.
176174
177175
Since we want to discourage accessing the transaction object directly, the `Sentry.setMeasurement` top level method will also be introduced. This will set a custom performance metric if a transaction exists. If a transaction doesn't exist, this method will do nothing. In the future, this method will attach the measurement to the span on the scope, but for now it'll only attach it to the transaction.
178176

0 commit comments

Comments
 (0)