diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index 390d455c891b..00e807ed177c 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -252,6 +252,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`. - `Client` now always expects the `BaseClient` class - there is no more abstract `Client` that can be implemented! Any `Client` class has to extend from `BaseClient`. - `ReportDialogOptions` now extends `Record` instead of `Record` - this should not affect most users. diff --git a/packages/core/src/tracing/trace.ts b/packages/core/src/tracing/trace.ts index 28b9654d5266..177e13de4892 100644 --- a/packages/core/src/tracing/trace.ts +++ b/packages/core/src/tracing/trace.ts @@ -402,10 +402,6 @@ function _startRootSpan(spanArguments: SentrySpanArguments, scope: Scope, parent name, parentSampled, attributes, - transactionContext: { - name, - parentSampled, - }, }); const rootSpan = new SentrySpan({ diff --git a/packages/core/src/types-hoist/samplingcontext.ts b/packages/core/src/types-hoist/samplingcontext.ts index 0c73ba0968c2..d406b851be88 100644 --- a/packages/core/src/types-hoist/samplingcontext.ts +++ b/packages/core/src/types-hoist/samplingcontext.ts @@ -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. */ diff --git a/packages/core/test/lib/tracing/trace.test.ts b/packages/core/test/lib/tracing/trace.test.ts index e545e814f81d..8c52ee95316e 100644 --- a/packages/core/test/lib/tracing/trace.test.ts +++ b/packages/core/test/lib/tracing/trace.test.ts @@ -503,7 +503,6 @@ describe('startSpan', () => { test2: 'aa', test3: 'bb', }, - transactionContext: expect.objectContaining({ name: 'outer', parentSampled: undefined }), }); }); diff --git a/packages/opentelemetry/src/sampler.ts b/packages/opentelemetry/src/sampler.ts index 8f90bc2e9ec6..ecaf8340e3f5 100644 --- a/packages/opentelemetry/src/sampler.ts +++ b/packages/opentelemetry/src/sampler.ts @@ -103,10 +103,6 @@ export class SentrySampler implements Sampler { const [sampled, sampleRate] = sampleSpan(options, { name: inferredSpanName, attributes: mergedAttributes, - transactionContext: { - name: inferredSpanName, - parentSampled, - }, parentSampled, }); diff --git a/packages/opentelemetry/test/trace.test.ts b/packages/opentelemetry/test/trace.test.ts index 3eedc0743ea0..a9dc652ddf21 100644 --- a/packages/opentelemetry/test/trace.test.ts +++ b/packages/opentelemetry/test/trace.test.ts @@ -1322,7 +1322,6 @@ describe('trace (sampling)', () => { parentSampled: undefined, name: 'outer', attributes: {}, - transactionContext: { name: 'outer', parentSampled: undefined }, }); // Now return `false`, it should not sample @@ -1342,7 +1341,6 @@ describe('trace (sampling)', () => { parentSampled: undefined, name: 'outer', attributes: {}, - transactionContext: { name: 'outer', parentSampled: undefined }, }), ); expect(tracesSampler).toHaveBeenCalledWith( @@ -1350,7 +1348,6 @@ describe('trace (sampling)', () => { parentSampled: undefined, name: 'outer2', attributes: {}, - transactionContext: { name: 'outer2', parentSampled: undefined }, }), ); @@ -1391,7 +1388,6 @@ describe('trace (sampling)', () => { attr2: 1, 'sentry.op': 'test.op', }, - transactionContext: { name: 'outer', parentSampled: undefined }, }); // Now return `0`, it should not sample @@ -1411,7 +1407,6 @@ describe('trace (sampling)', () => { parentSampled: undefined, name: 'outer2', attributes: {}, - transactionContext: { name: 'outer2', parentSampled: undefined }, }), ); @@ -1434,7 +1429,6 @@ describe('trace (sampling)', () => { parentSampled: undefined, name: 'outer3', attributes: {}, - transactionContext: { name: 'outer3', parentSampled: undefined }, }); }); @@ -1468,10 +1462,6 @@ describe('trace (sampling)', () => { parentSampled: true, name: 'outer', attributes: {}, - transactionContext: { - name: 'outer', - parentSampled: true, - }, }); }); diff --git a/packages/profiling-node/src/spanProfileUtils.ts b/packages/profiling-node/src/spanProfileUtils.ts index 39196578a9bc..1ee050ce22e5 100644 --- a/packages/profiling-node/src/spanProfileUtils.ts +++ b/packages/profiling-node/src/spanProfileUtils.ts @@ -48,10 +48,6 @@ export function maybeProfileSpan( profilesSampleRate = profilesSampler({ name: spanName, attributes: data, - transactionContext: { - name: spanName, - parentSampled, - }, parentSampled, ...customSamplingContext, }); diff --git a/packages/solidstart/src/config/wrapServerEntryWithDynamicImport.ts b/packages/solidstart/src/config/wrapServerEntryWithDynamicImport.ts index 6d069220e1ae..8f8c7a59f1f4 100644 --- a/packages/solidstart/src/config/wrapServerEntryWithDynamicImport.ts +++ b/packages/solidstart/src/config/wrapServerEntryWithDynamicImport.ts @@ -53,7 +53,7 @@ export function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOp return { id: source, moduleSideEffects: true }; } - if (additionalImports && additionalImports.includes(source)) { + if (additionalImports?.includes(source)) { // When importing additional imports like "import-in-the-middle/hook.mjs" in the returned code of the `load()` function below: // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it // By importing "import-in-the-middle/hook.mjs", we can make sure this file is included, as not all node builders are including files imported with `module.register()`. @@ -70,7 +70,7 @@ export function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOp const resolution = await this.resolve(source, importer, options); // If it cannot be resolved or is external, just return it so that Rollup can display an error - if (!resolution || (resolution && resolution.external)) return resolution; + if (!resolution || resolution?.external) return resolution; const moduleInfo = await this.load(resolution); @@ -146,23 +146,21 @@ export function extractFunctionReexportQueryParameters(query: string): { wrap: s const wrapMatch = query.match(wrapRegex); const reexportMatch = query.match(reexportRegex); - const wrap = - wrapMatch && wrapMatch[1] - ? wrapMatch[1] - .split(',') - .filter(param => param !== '') - // Sanitize, as code could be injected with another rollup plugin - .map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')) - : []; - - const reexport = - reexportMatch && reexportMatch[1] - ? reexportMatch[1] - .split(',') - .filter(param => param !== '' && param !== 'default') - // Sanitize, as code could be injected with another rollup plugin - .map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')) - : []; + const wrap = wrapMatch?.[1] + ? wrapMatch[1] + .split(',') + .filter(param => param !== '') + // Sanitize, as code could be injected with another rollup plugin + .map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')) + : []; + + const reexport = reexportMatch?.[1] + ? reexportMatch[1] + .split(',') + .filter(param => param !== '' && param !== 'default') + // Sanitize, as code could be injected with another rollup plugin + .map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')) + : []; return { wrap, reexport }; }