Skip to content

Commit 8bfd701

Browse files
andreiborzaclaude
andcommitted
ref: Remove internal forceTransaction: true usages
Removes every `forceTransaction: true` that the SDK sets on its own spans. The public `forceTransaction` option on `startSpan*` and `trpcMiddleware` stays. Co-Authored-By: Opus 5 <noreply@anthropic.com>
1 parent 9d0a6f2 commit 8bfd701

9 files changed

Lines changed: 1 addition & 27 deletions

File tree

‎packages/aws-serverless/src/requestSpanOptions.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export function getRequestSpanOptions(event: unknown, context: Context, requestI
4646
// The span is started within the surrounding `continueTrace`, so it continues the incoming trace.
4747
return {
4848
name: context.functionName,
49-
forceTransaction: true,
5049
attributes: {
5150
[SENTRY_OP]: FUNCTION_AWS,
5251
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.aws_lambda',

‎packages/browser/src/tracing/browserTracingIntegration.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ export const browserTracingIntegration = ((options: Partial<BrowserTracingOption
520520
...startSpanOptions,
521521
// Navigation starts a new trace and is NOT parented under any active interaction (e.g. ui.action.click)
522522
parentSpan: null,
523-
forceTransaction: true,
524523
},
525524
true,
526525
navigationOptions?.url,

‎packages/core/src/integrations/mcp-server/spans.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ function createMcpSpan(config: McpSpanConfig): unknown {
113113
return startSpan(
114114
{
115115
name: spanName,
116-
forceTransaction: true,
117116
attributes,
118117
},
119118
callback,
@@ -185,7 +184,6 @@ export function buildMcpServerSpanConfig(
185184
): {
186185
name: string;
187186
op: string;
188-
forceTransaction: boolean;
189187
attributes: Record<string, string | number>;
190188
} {
191189
const { method } = jsonRpcMessage;
@@ -211,7 +209,6 @@ export function buildMcpServerSpanConfig(
211209
return {
212210
name: spanName,
213211
op: MCP_SERVER_OP_VALUE,
214-
forceTransaction: true,
215212
attributes,
216213
};
217214
}

‎packages/core/test/lib/integrations/mcp-server/semanticConventions.test.ts‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ describe('MCP Server Semantic Conventions', () => {
4848
expect(startInactiveSpanSpy).toHaveBeenCalledWith({
4949
name: 'tools/call get-weather',
5050
op: 'mcp.server',
51-
forceTransaction: true,
5251
attributes: {
5352
'mcp.method.name': 'tools/call',
5453
'mcp.tool.name': 'get-weather',
@@ -82,7 +81,6 @@ describe('MCP Server Semantic Conventions', () => {
8281
expect(startInactiveSpanSpy).toHaveBeenCalledWith({
8382
name: 'resources/read file:///docs/api.md',
8483
op: 'mcp.server',
85-
forceTransaction: true,
8684
attributes: {
8785
'mcp.method.name': 'resources/read',
8886
'mcp.resource.uri': 'file:///docs/api.md',
@@ -114,7 +112,6 @@ describe('MCP Server Semantic Conventions', () => {
114112
expect(startInactiveSpanSpy).toHaveBeenCalledWith({
115113
name: 'prompts/get analyze-code',
116114
op: 'mcp.server',
117-
forceTransaction: true,
118115
attributes: {
119116
'mcp.method.name': 'prompts/get',
120117
'mcp.prompt.name': 'analyze-code',
@@ -145,7 +142,6 @@ describe('MCP Server Semantic Conventions', () => {
145142
expect(startSpanSpy).toHaveBeenCalledWith(
146143
{
147144
name: 'notifications/tools/list_changed',
148-
forceTransaction: true,
149145
attributes: {
150146
'mcp.method.name': 'notifications/tools/list_changed',
151147
'mcp.session.id': 'test-session-123',
@@ -182,7 +178,6 @@ describe('MCP Server Semantic Conventions', () => {
182178
expect(startInactiveSpanSpy).toHaveBeenCalledWith(
183179
expect.objectContaining({
184180
name: 'tools/list',
185-
forceTransaction: true,
186181
attributes: expect.objectContaining({
187182
'mcp.method.name': 'tools/list',
188183
'mcp.request.id': 'req-4',
@@ -218,7 +213,6 @@ describe('MCP Server Semantic Conventions', () => {
218213
expect(startSpanSpy).toHaveBeenCalledWith(
219214
{
220215
name: 'notifications/message',
221-
forceTransaction: true,
222216
attributes: {
223217
'mcp.method.name': 'notifications/message',
224218
'mcp.session.id': 'test-session-123',
@@ -420,7 +414,6 @@ describe('MCP Server Semantic Conventions', () => {
420414
expect.objectContaining({
421415
name: 'tools/call weather-lookup',
422416
op: 'mcp.server',
423-
forceTransaction: true,
424417
attributes: expect.objectContaining({
425418
'mcp.method.name': 'tools/call',
426419
'mcp.tool.name': 'weather-lookup',
@@ -493,7 +486,6 @@ describe('MCP Server Semantic Conventions', () => {
493486
expect.objectContaining({
494487
name: 'prompts/get code-review',
495488
op: 'mcp.server',
496-
forceTransaction: true,
497489
attributes: expect.objectContaining({
498490
'mcp.method.name': 'prompts/get',
499491
'mcp.prompt.name': 'code-review',

‎packages/core/test/lib/integrations/mcp-server/transportInstrumentation.test.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ describe('MCP Server Transport Instrumentation', () => {
117117
expect(startInactiveSpanSpy).toHaveBeenCalledWith(
118118
expect.objectContaining({
119119
name: 'tools/call get-weather',
120-
forceTransaction: true,
121120
}),
122121
);
123122
});
@@ -137,7 +136,6 @@ describe('MCP Server Transport Instrumentation', () => {
137136
expect(startSpanSpy).toHaveBeenCalledWith(
138137
expect.objectContaining({
139138
name: 'notifications/initialized',
140-
forceTransaction: true,
141139
}),
142140
expect.any(Function),
143141
);
@@ -158,7 +156,6 @@ describe('MCP Server Transport Instrumentation', () => {
158156
expect(startSpanSpy).toHaveBeenCalledWith(
159157
expect.objectContaining({
160158
name: 'notifications/tools/list_changed',
161-
forceTransaction: true,
162159
}),
163160
expect.any(Function),
164161
);
@@ -271,7 +268,6 @@ describe('MCP Server Transport Instrumentation', () => {
271268
expect(startInactiveSpanSpy).toHaveBeenCalledWith({
272269
name: 'tools/call process-file',
273270
op: 'mcp.server',
274-
forceTransaction: true,
275271
attributes: {
276272
'mcp.method.name': 'tools/call',
277273
'mcp.tool.name': 'process-file',
@@ -421,7 +417,6 @@ describe('MCP Server Transport Instrumentation', () => {
421417
expect(config).toEqual({
422418
name: 'tools/call test-tool',
423419
op: 'mcp.server',
424-
forceTransaction: true,
425420
attributes: expect.objectContaining({
426421
'mcp.method.name': 'tools/call',
427422
'mcp.tool.name': 'test-tool',
@@ -873,7 +868,6 @@ describe('MCP Server Transport Instrumentation', () => {
873868
expect(startSpanSpy).toHaveBeenCalledWith(
874869
{
875870
name: 'notifications/tools/list_changed',
876-
forceTransaction: true,
877871
attributes: {
878872
'mcp.transport': 'StreamableHTTPServerTransport',
879873
'network.transport': 'tcp',

‎packages/nestjs/src/integrations/helpers.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,13 @@ export function getMiddlewareSpanOptions(
109109
export function getEventSpanOptions(event: string): {
110110
name: string;
111111
attributes: Record<string, string>;
112-
forceTransaction: boolean;
113112
} {
114113
return {
115114
name: `event ${event}`,
116115
attributes: {
117116
[SENTRY_OP]: FUNCTION,
118117
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.event.nestjs',
119118
},
120-
forceTransaction: true,
121119
};
122120
}
123121

@@ -130,7 +128,6 @@ const PROCESS_OPERATION = 'process';
130128
export function getBullMQProcessSpanOptions(queueName: string | undefined): {
131129
name: string;
132130
attributes: Record<string, string | undefined>;
133-
forceTransaction: boolean;
134131
} {
135132
const client = getClient();
136133
const isStreamed = !!client && hasSpanStreamingEnabled(client);
@@ -151,7 +148,6 @@ export function getBullMQProcessSpanOptions(queueName: string | undefined): {
151148
[MESSAGING_OPERATION_TYPE]: PROCESS_OPERATION,
152149
[MESSAGING_DESTINATION_NAME]: queueName,
153150
},
154-
forceTransaction: true,
155151
};
156152
}
157153

‎packages/nextjs/src/common/withServerActionInstrumentation.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ async function withServerActionInstrumentationImplementation<A extends (...args:
114114
return await startSpan(
115115
{
116116
name: `serverAction/${serverActionName}`,
117-
forceTransaction: true,
118117
attributes: {
119118
[SENTRY_KIND]: 'server',
120119
[SENTRY_OP]: FUNCTION,

‎packages/react-router/src/server/createServerInstrumentation.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export function createSentryServerInstrumentation(
104104
await startSpan(
105105
{
106106
name: unparameterizedName,
107-
forceTransaction: true,
108107
attributes: {
109108
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server',
110109
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api',

‎packages/react-router/test/server/createServerInstrumentation.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,10 @@ describe('createSentryServerInstrumentation', () => {
165165

166166
await hooks.request(mockHandleRequest, { request: mockRequest, context: undefined });
167167

168-
// Should create a new root span with forceTransaction
168+
// Should create a new root span
169169
expect(core.startSpan).toHaveBeenCalledWith(
170170
expect.objectContaining({
171171
name: 'GET /api/users',
172-
forceTransaction: true,
173172
attributes: expect.objectContaining({
174173
'sentry.op': 'http.server',
175174
'sentry.origin': 'auto.http.react_router.instrumentation_api',

0 commit comments

Comments
 (0)