Skip to content

Commit

Permalink
feat(core): Remove transactionContext from samplingContext
Browse files Browse the repository at this point in the history
  • Loading branch information
s1gr1d committed Jan 7, 2025
1 parent c347dae commit 29808e1
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 31 deletions.
1 change: 1 addition & 0 deletions docs/migration/v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ Since v9, the types have been merged into `@sentry/core`, which removed some of
- The `Request` type has been removed. Use `RequestEventData` type instead.
- The `IntegrationClass` type is no longer exported - it was not used anymore. Instead, use `Integration` or `IntegrationFn`.
- The `samplingContext.request` attribute in the `tracesSampler` has been removed. Use `samplingContext.normalizedRequest` instead. Note that the type of `normalizedRequest` differs from `request`.
- The `samplingContext.transactionContext` object in the `tracesSampler` has been removed. All object attributes are available in the top-level of `samplingContext`.

# No Version Support Timeline

Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/tracing/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,6 @@ function _startRootSpan(spanArguments: SentrySpanArguments, scope: Scope, parent
name,
parentSampled,
attributes,
transactionContext: {
name,
parentSampled,
},
});

const rootSpan = new SentrySpan({
Expand Down
9 changes: 0 additions & 9 deletions packages/core/src/types-hoist/samplingcontext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ export interface CustomSamplingContext {
* Adds default data to data provided by the user. See {@link Hub.startTransaction}
*/
export interface SamplingContext extends CustomSamplingContext {
/**
* Context data with which transaction being sampled was created.
* @deprecated This is duplicate data and will be removed eventually.
*/
transactionContext: {
name: string;
parentSampled?: boolean | undefined;
};

/**
* Sampling decision from the parent transaction, if any.
*/
Expand Down
1 change: 0 additions & 1 deletion packages/core/test/lib/tracing/trace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ describe('startSpan', () => {
test2: 'aa',
test3: 'bb',
},
transactionContext: expect.objectContaining({ name: 'outer', parentSampled: undefined }),
});
});

Expand Down
4 changes: 0 additions & 4 deletions packages/opentelemetry/src/sampler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ export class SentrySampler implements Sampler {
const [sampled, sampleRate] = sampleSpan(options, {
name: inferredSpanName,
attributes: mergedAttributes,
transactionContext: {
name: inferredSpanName,
parentSampled,
},
parentSampled,
});

Expand Down
9 changes: 0 additions & 9 deletions packages/opentelemetry/test/trace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,6 @@ describe('trace (sampling)', () => {
parentSampled: undefined,
name: 'outer',
attributes: {},
transactionContext: { name: 'outer', parentSampled: undefined },
});

// Now return `false`, it should not sample
Expand All @@ -1341,7 +1340,6 @@ describe('trace (sampling)', () => {
parentSampled: false,
name: 'inner2',
attributes: {},
transactionContext: { name: 'inner2', parentSampled: false },
});
});

Expand Down Expand Up @@ -1376,7 +1374,6 @@ describe('trace (sampling)', () => {
attr2: 1,
'sentry.op': 'test.op',
},
transactionContext: { name: 'outer', parentSampled: undefined },
});

// Now return `0`, it should not sample
Expand All @@ -1395,7 +1392,6 @@ describe('trace (sampling)', () => {
parentSampled: false,
name: 'inner2',
attributes: {},
transactionContext: { name: 'inner2', parentSampled: false },
});

// Now return `0.4`, it should not sample
Expand All @@ -1410,7 +1406,6 @@ describe('trace (sampling)', () => {
parentSampled: undefined,
name: 'outer3',
attributes: {},
transactionContext: { name: 'outer3', parentSampled: undefined },
});
});

Expand Down Expand Up @@ -1444,10 +1439,6 @@ describe('trace (sampling)', () => {
parentSampled: true,
name: 'outer',
attributes: {},
transactionContext: {
name: 'outer',
parentSampled: true,
},
});
});

Expand Down
4 changes: 0 additions & 4 deletions packages/profiling-node/src/spanProfileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ export function maybeProfileSpan(
profilesSampleRate = profilesSampler({
name: spanName,
attributes: data,
transactionContext: {
name: spanName,
parentSampled,
},
parentSampled,
...customSamplingContext,
});
Expand Down

0 comments on commit 29808e1

Please sign in to comment.