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
Copy file name to clipboardExpand all lines: docs/platforms/javascript/common/enriching-events/process-isolation/index.mdx
+8-19Lines changed: 8 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,27 +21,16 @@ notSupported:
21
21
22
22
In server-side environments, the <PlatformLinkto='/enriching-events/scopes'>isolation scope</PlatformLink> is automatically forked around request boundaries. This means that each request will have its own isolation scope, and data set on the isolation scope will only apply to events captured during that request. This is done automatically by the SDK.
23
23
24
-
However, the request isolation happens when the request callback itself is being executed. This means that if you e.g. have a middleware where you want to set Sentry data (e.g. `Sentry.setUser()`in an auth middleware), you have to manually fork the isolation scope with `Sentry.withIsolationScope()` - see [Using withIsolationScope](../scopes/#using-withisolationscope).
24
+
However, tehre are also other cases where you may want to have isolation, for example in background jobs or when you want to isolate a specific part of your code. In these cases, you can use `Sentry.withIsolationScope()`to create a new isolation scope that is valid inside of the callback you pass to it - see [Using withIsolationScope](../scopes/#using-withisolationscope).
25
25
26
-
This is also necessary if you want to isolate a non-request process, e.g. a background job.
27
-
28
-
The following example shows how you can use `withIsolationScope` to attach a user and a tag in an auth middleware:
26
+
The following example shows how you can use `withIsolationScope` to attach data for a specific job run:
0 commit comments