From c66542426451d0b52885ffbc2cd78873476235c3 Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Mon, 31 Aug 2026 10:56:41 +0200 Subject: [PATCH] ref: Remove redundant `forceTransaction: true` usages Removes `forceTransaction: true` where the span is already a root span, so the option had no effect: - `aws-serverless`: the `function.aws` invocation span - `browser`: the navigation span, which already passes `parentSpan: null` - `nestjs`: the BullMQ process span, since queue jobs run outside a request - `react-router`: the server request span, on the branch that only runs when there is no root span Co-Authored-By: Opus 5 --- packages/aws-serverless/src/requestSpanOptions.ts | 1 - packages/browser/src/tracing/browserTracingIntegration.ts | 1 - packages/nestjs/src/integrations/helpers.ts | 2 -- .../react-router/src/server/createServerInstrumentation.ts | 1 - .../test/server/createServerInstrumentation.test.ts | 3 +-- 5 files changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/aws-serverless/src/requestSpanOptions.ts b/packages/aws-serverless/src/requestSpanOptions.ts index ed41aa2d334b..80faf9d3c1e9 100644 --- a/packages/aws-serverless/src/requestSpanOptions.ts +++ b/packages/aws-serverless/src/requestSpanOptions.ts @@ -46,7 +46,6 @@ export function getRequestSpanOptions(event: unknown, context: Context, requestI // The span is started within the surrounding `continueTrace`, so it continues the incoming trace. return { name: context.functionName, - forceTransaction: true, attributes: { [SENTRY_OP]: FUNCTION_AWS, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.aws_lambda', diff --git a/packages/browser/src/tracing/browserTracingIntegration.ts b/packages/browser/src/tracing/browserTracingIntegration.ts index 196bbcfb01a5..49e6abf319c5 100644 --- a/packages/browser/src/tracing/browserTracingIntegration.ts +++ b/packages/browser/src/tracing/browserTracingIntegration.ts @@ -521,7 +521,6 @@ export const browserTracingIntegration = ((options: Partial; - forceTransaction: boolean; } { const client = getClient(); const isStreamed = !!client && hasSpanStreamingEnabled(client); @@ -151,7 +150,6 @@ export function getBullMQProcessSpanOptions(queueName: string | undefined): { [MESSAGING_OPERATION_TYPE]: PROCESS_OPERATION, [MESSAGING_DESTINATION_NAME]: queueName, }, - forceTransaction: true, }; } diff --git a/packages/react-router/src/server/createServerInstrumentation.ts b/packages/react-router/src/server/createServerInstrumentation.ts index a0c966216763..4ca18b21d1c8 100644 --- a/packages/react-router/src/server/createServerInstrumentation.ts +++ b/packages/react-router/src/server/createServerInstrumentation.ts @@ -103,7 +103,6 @@ export function createSentryServerInstrumentation( await startSpan( { name: unparameterizedName, - forceTransaction: true, attributes: { [SENTRY_OP]: HTTP_SERVER, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api', diff --git a/packages/react-router/test/server/createServerInstrumentation.test.ts b/packages/react-router/test/server/createServerInstrumentation.test.ts index 011e2e79819e..9ac0ad924277 100644 --- a/packages/react-router/test/server/createServerInstrumentation.test.ts +++ b/packages/react-router/test/server/createServerInstrumentation.test.ts @@ -165,11 +165,10 @@ describe('createSentryServerInstrumentation', () => { await hooks.request(mockHandleRequest, { request: mockRequest, context: undefined }); - // Should create a new root span with forceTransaction + // Should create a new root span expect(core.startSpan).toHaveBeenCalledWith( expect.objectContaining({ name: 'GET /api/users', - forceTransaction: true, attributes: expect.objectContaining({ 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.instrumentation_api',