|
1 | 1 | /* eslint-disable max-lines */
|
2 | 2 | import { getEnvelopeEndpointWithUrlEncodedAuth } from './api';
|
3 | 3 | import { DEFAULT_ENVIRONMENT } from './constants';
|
4 |
| -import { getCurrentScope, getIsolationScope, getTraceContextFromScope } from './currentScopes'; |
| 4 | +import { getCurrentScope, getIsolationScope, getTraceContextFromScope, withScope } from './currentScopes'; |
5 | 5 | import { DEBUG_BUILD } from './debug-build';
|
6 | 6 | import { createEventEnvelope, createSessionEnvelope } from './envelope';
|
7 | 7 | import type { IntegrationIndex } from './integration';
|
@@ -36,8 +36,7 @@ import { getPossibleEventMessages } from './utils/eventUtils';
|
36 | 36 | import { merge } from './utils/merge';
|
37 | 37 | import { parseSampleRate } from './utils/parseSampleRate';
|
38 | 38 | import { prepareEvent } from './utils/prepareEvent';
|
39 |
| -import { _getSpanForScope } from './utils/spanOnScope'; |
40 |
| -import { showSpanDropWarning, spanToTraceContext } from './utils/spanUtils'; |
| 39 | +import { getActiveSpan, showSpanDropWarning, spanToTraceContext } from './utils/spanUtils'; |
41 | 40 | import { convertSpanJsonToTransactionEvent, convertTransactionEventToSpanJson } from './utils/transactionEvent';
|
42 | 41 | import { createClientReportEnvelope } from './utils-hoist/clientreport';
|
43 | 42 | import { dsnToString, makeDsn } from './utils-hoist/dsn';
|
@@ -1325,10 +1324,12 @@ export function _getTraceInfoFromScope(
|
1325 | 1324 | return [undefined, undefined];
|
1326 | 1325 | }
|
1327 | 1326 |
|
1328 |
| -const span = _getSpanForScope(scope); |
1329 |
| -const traceContext = span ? spanToTraceContext(span) : getTraceContextFromScope(scope); |
1330 |
| -const dynamicSamplingContext = span |
1331 |
| -? getDynamicSamplingContextFromSpan(span) |
1332 |
| -: getDynamicSamplingContextFromScope(client, scope); |
1333 |
| -return [dynamicSamplingContext, traceContext]; |
| 1327 | +return withScope(scope, () => { |
| 1328 | +const span = getActiveSpan(); |
| 1329 | +const traceContext = span ? spanToTraceContext(span) : getTraceContextFromScope(scope); |
| 1330 | +const dynamicSamplingContext = span |
| 1331 | +? getDynamicSamplingContextFromSpan(span) |
| 1332 | +: getDynamicSamplingContextFromScope(client, scope); |
| 1333 | +return [dynamicSamplingContext, traceContext]; |
| 1334 | +}); |
1334 | 1335 | }
|
0 commit comments