Skip to content

Commit b111b97

Browse files
committed
better docs
1 parent 8a5da44 commit b111b97

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/node-experimental/src/sdk/otelAsyncContextStrategy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { OTEL_CONTEXT_HUB_KEY } from './otelContextManager';
66

77
/**
88
* 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)
910
*/
1011
export function setOtelContextAsyncContextStrategy(): void {
1112
function getCurrentHub(): Hub | undefined {

packages/node-experimental/src/sdk/otelContextManager.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ function createNewHub(parent: Hub | undefined): Hub {
1212
return getHubFromCarrier(carrier);
1313
}
1414

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+
*/
1622
export class SentryContextManager extends AsyncLocalStorageContextManager {
1723
/**
1824
* Overwrite with() of the original AsyncLocalStorageContextManager

0 commit comments

Comments
 (0)