Skip to content

Commit 9ae72e2

Browse files
andreiborzaclaude
andauthored
feat(node)!: Drop support for Fastify <3.21.0 (#22752)
## What Drops support for Fastify `<3.21.0` by removing `FastifyInstrumentationV3` (and `instrumentFastifyV3`). The node `fastifyIntegration` becomes a thin pass-through to the channel-based integration in `@sentry/server-utils`. ## Why The channel-based `fastifyIntegration` (default since #22501) covers Fastify `>=3.21.0 <6`. The v3 OpenTelemetry instrumentation only existed to fill the `>=3.0.0 <3.21.0` gap, and it was the last remaining import-in-the-middle module-patcher in `@sentry/node`. Dropping the old Fastify range lets us remove it. Ref: #22346 --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5ad415c commit 9ae72e2

10 files changed

Lines changed: 5 additions & 643 deletions

File tree

dev-packages/e2e-tests/test-applications/node-fastify-3/package.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"clean": "npx rimraf node_modules pnpm-lock.yaml",
1111
"typecheck": "tsc",
1212
"test:build": "pnpm install && pnpm run typecheck",
13-
"test:build-3_20": "pnpm install && pnpm add fastify@~3.20.0 && pnpm run typecheck",
1413
"test:assert": "pnpm test && pnpm test:override"
1514
},
1615
"dependencies": {
@@ -26,13 +25,5 @@
2625
},
2726
"volta": {
2827
"extends": "../../package.json"
29-
},
30-
"sentryTest": {
31-
"variants": [
32-
{
33-
"build-command": "pnpm test:build-3_20",
34-
"label": "fastify v3.20.0"
35-
}
36-
]
3728
}
3829
}

dev-packages/e2e-tests/test-applications/node-fastify-3/tests/transactions.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ test.skip('Sends an API route transaction', async ({ baseURL }) => {
9898
data: expect.objectContaining({
9999
'sentry.origin': 'auto.http.otel.fastify',
100100
'sentry.op': 'request_handler.fastify',
101-
// format is slightly different in v3.20.0 and v3.21.0
102101
'fastify.type': expect.stringMatching(/request[-_]handler/),
103102
'http.route': '/test-transaction',
104103
}),

packages/node/src/integrations/tracing/fastify/index.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import type { Integration, IntegrationFn } from '@sentry/core';
2-
import { defineIntegration, extendIntegration, getClient } from '@sentry/core';
3-
import { generateInstrumentOnce } from '../../../otel/instrument';
1+
import type { Integration } from '@sentry/core';
2+
import { defineIntegration, getClient } from '@sentry/core';
43
import type { FastifyInstance, FastifyMinimal, FastifyReply, FastifyRequest } from './types';
5-
import { FastifyInstrumentationV3 } from './v3/instrumentation';
64
import {
75
fastifyIntegration as serverUtilsFastifyIntegration,
86
instrumentFastify,
@@ -94,11 +92,6 @@ interface FastifyHandlerOptions {
9492

9593
const INTEGRATION_NAME = 'Fastify' as const;
9694

97-
export const instrumentFastifyV3 = generateInstrumentOnce(
98-
`${INTEGRATION_NAME}.v3`,
99-
() => new FastifyInstrumentationV3(),
100-
);
101-
10295
function getFastifyIntegration(): FastifyIntegration | undefined {
10396
const client = getClient();
10497
if (!client) {
@@ -108,16 +101,6 @@ function getFastifyIntegration(): FastifyIntegration | undefined {
108101
}
109102
}
110103

111-
const _fastifyIntegration = ((options: Partial<FastifyIntegrationOptions>) => {
112-
const parentIntegration = serverUtilsFastifyIntegration(options) as FastifyIntegration;
113-
114-
return extendIntegration(parentIntegration, {
115-
setupOnce() {
116-
instrumentFastifyV3();
117-
},
118-
});
119-
}) satisfies IntegrationFn;
120-
121104
/**
122105
* Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).
123106
*
@@ -135,7 +118,7 @@ const _fastifyIntegration = ((options: Partial<FastifyIntegrationOptions>) => {
135118
* ```
136119
*/
137120
export const fastifyIntegration = defineIntegration((options: Partial<FastifyIntegrationOptions> = {}) =>
138-
_fastifyIntegration(options),
121+
serverUtilsFastifyIntegration(options),
139122
);
140123

141124
/**

packages/node/src/integrations/tracing/fastify/v3/constants.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/node/src/integrations/tracing/fastify/v3/enums/AttributeNames.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)