File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
packages/node-experimental/src/sdk Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { OTEL_CONTEXT_HUB_KEY } from './otelContextManager';
6
6
7
7
/**
8
8
* Sets the async context strategy to use follow the OTEL context under the hood.
9
+ * We handle forking a hub inside of our custom OTEL Context Manager (./otelContextManager.ts)
9
10
*/
10
11
export function setOtelContextAsyncContextStrategy ( ) : void {
11
12
function getCurrentHub ( ) : Hub | undefined {
Original file line number Diff line number Diff line change @@ -12,7 +12,13 @@ function createNewHub(parent: Hub | undefined): Hub {
12
12
return getHubFromCarrier ( carrier ) ;
13
13
}
14
14
15
- /** TODO docs */
15
+ /**
16
+ * This is a custom ContextManager for OpenTelemetry, which extends the default AsyncLocalStorageContextManager.
17
+ * It ensures that we create a new hub per context, so that the OTEL Context & the Sentry Hub are always in sync.
18
+ *
19
+ * Note that we currently only support AsyncHooks with this,
20
+ * but since this should work for Node 14+ anyhow that should be good enough.
21
+ */
16
22
export class SentryContextManager extends AsyncLocalStorageContextManager {
17
23
/**
18
24
* Overwrite with() of the original AsyncLocalStorageContextManager
You can’t perform that action at this time.
0 commit comments