Skip to content

Commit b4c814e

Browse files
committed
feat(core): Remove transactionContext from samplingContext
1 parent d951476 commit b4c814e

File tree

7 files changed

+1
-31
lines changed

7 files changed

+1
-31
lines changed

docs/migration/v8-to-v9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ Since v9, the types have been merged into `@sentry/core`, which removed some of
220220
- The `TransactionNamingScheme` type has been removed. There is no replacement.
221221
- The `Request` type has been removed. Use `RequestEventData` type instead.
222222
- The `IntegrationClass` type is no longer exported - it was not used anymore. Instead, use `Integration` or `IntegrationFn`.
223+
- The `samplingContext.transactionContext` object in `tracesSampler` has been removed. All object attributes are available in the top-level of `samplingContext`.
223224

224225
# No Version Support Timeline
225226

packages/core/src/tracing/trace.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,6 @@ function _startRootSpan(spanArguments: SentrySpanArguments, scope: Scope, parent
381381
name,
382382
parentSampled,
383383
attributes,
384-
transactionContext: {
385-
name,
386-
parentSampled,
387-
},
388384
});
389385

390386
const rootSpan = new SentrySpan({

packages/core/src/types-hoist/samplingcontext.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ export interface CustomSamplingContext {
1414
* Adds default data to data provided by the user. See {@link Hub.startTransaction}
1515
*/
1616
export interface SamplingContext extends CustomSamplingContext {
17-
/**
18-
* Context data with which transaction being sampled was created.
19-
* @deprecated This is duplicate data and will be removed eventually.
20-
*/
21-
transactionContext: {
22-
name: string;
23-
parentSampled?: boolean | undefined;
24-
};
25-
2617
/**
2718
* Sampling decision from the parent transaction, if any.
2819
*/

packages/core/test/lib/tracing/trace.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,6 @@ describe('startSpan', () => {
496496
test2: 'aa',
497497
test3: 'bb',
498498
},
499-
transactionContext: expect.objectContaining({ name: 'outer', parentSampled: undefined }),
500499
});
501500
});
502501

packages/opentelemetry/src/sampler.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ export class SentrySampler implements Sampler {
9999
const [sampled, sampleRate] = sampleSpan(options, {
100100
name: inferredSpanName,
101101
attributes: mergedAttributes,
102-
transactionContext: {
103-
name: inferredSpanName,
104-
parentSampled,
105-
},
106102
parentSampled,
107103
});
108104

packages/opentelemetry/test/trace.test.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,6 @@ describe('trace (sampling)', () => {
13221322
parentSampled: undefined,
13231323
name: 'outer',
13241324
attributes: {},
1325-
transactionContext: { name: 'outer', parentSampled: undefined },
13261325
});
13271326

13281327
// Now return `false`, it should not sample
@@ -1341,7 +1340,6 @@ describe('trace (sampling)', () => {
13411340
parentSampled: false,
13421341
name: 'inner2',
13431342
attributes: {},
1344-
transactionContext: { name: 'inner2', parentSampled: false },
13451343
});
13461344
});
13471345

@@ -1376,7 +1374,6 @@ describe('trace (sampling)', () => {
13761374
attr2: 1,
13771375
'sentry.op': 'test.op',
13781376
},
1379-
transactionContext: { name: 'outer', parentSampled: undefined },
13801377
});
13811378

13821379
// Now return `0`, it should not sample
@@ -1395,7 +1392,6 @@ describe('trace (sampling)', () => {
13951392
parentSampled: false,
13961393
name: 'inner2',
13971394
attributes: {},
1398-
transactionContext: { name: 'inner2', parentSampled: false },
13991395
});
14001396

14011397
// Now return `0.4`, it should not sample
@@ -1410,7 +1406,6 @@ describe('trace (sampling)', () => {
14101406
parentSampled: undefined,
14111407
name: 'outer3',
14121408
attributes: {},
1413-
transactionContext: { name: 'outer3', parentSampled: undefined },
14141409
});
14151410
});
14161411

@@ -1444,10 +1439,6 @@ describe('trace (sampling)', () => {
14441439
parentSampled: true,
14451440
name: 'outer',
14461441
attributes: {},
1447-
transactionContext: {
1448-
name: 'outer',
1449-
parentSampled: true,
1450-
},
14511442
});
14521443
});
14531444

packages/profiling-node/src/spanProfileUtils.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ export function maybeProfileSpan(
4848
profilesSampleRate = profilesSampler({
4949
name: spanName,
5050
attributes: data,
51-
transactionContext: {
52-
name: spanName,
53-
parentSampled,
54-
},
5551
parentSampled,
5652
...customSamplingContext,
5753
});

0 commit comments

Comments
 (0)