Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Make runWithAsyncContext public API #7817

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/core/src/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,11 @@ export function setAsyncContextStrategy(strategy: AsyncContextStrategy | undefin
}

/**
* @private Private API with no semver guarantees!
* Runs the supplied callback in its own async context. Async Context strategies are defined per SDK.
*
* Runs the supplied callback in its own async context.
* @param callback The callback to run in its own async context
* @param options Options to pass to the async context strategy
* @returns The result of the callback
*/
export function runWithAsyncContext<T>(callback: (hub: Hub) => T, options: RunWithAsyncContextOptions = {}): T {
const registry = getMainCarrier();
Expand Down