UNPKG

1.86 kBTypeScriptView Raw
1import type { Scope } from '@sentry/types';
2import type { startInactiveSpan, startSpan, startSpanManual, suppressTracing, withActiveSpan } from './../tracing/trace';
3import type { getActiveSpan } from './../utils/spanUtils';
4/**
5 * @private Private API with no semver guarantees!
6 *
7 * Strategy used to track async context.
8 */
9export interface AsyncContextStrategy {
10 /**
11 * Fork the isolation scope inside of the provided callback.
12 */
13 withIsolationScope: <T>(callback: (isolationScope: Scope) => T) => T;
14 /**
15 * Fork the current scope inside of the provided callback.
16 */
17 withScope: <T>(callback: (isolationScope: Scope) => T) => T;
18 /**
19 * Set the provided scope as the current scope inside of the provided callback.
20 */
21 withSetScope: <T>(scope: Scope, callback: (scope: Scope) => T) => T;
22 /**
23 * Set the provided isolation as the current isolation scope inside of the provided callback.
24 */
25 withSetIsolationScope: <T>(isolationScope: Scope, callback: (isolationScope: Scope) => T) => T;
26 /**
27 * Get the currently active scope.
28 */
29 getCurrentScope: () => Scope;
30 /**
31 * Get the currently active isolation scope.
32 */
33 getIsolationScope: () => Scope;
34 /** Start an active span. */
35 startSpan?: typeof startSpan;
36 /** Start an inactive span. */
37 startInactiveSpan?: typeof startInactiveSpan;
38 /** Start an active manual span. */
39 startSpanManual?: typeof startSpanManual;
40 /** Get the currently active span. */
41 getActiveSpan?: typeof getActiveSpan;
42 /** Make a span the active span in the context of the callback. */
43 withActiveSpan?: typeof withActiveSpan;
44 /** Suppress tracing in the given callback, ensuring no spans are generated inside of it. */
45 suppressTracing?: typeof suppressTracing;
46}
47//# sourceMappingURL=types.d.ts.map
\No newline at end of file