Skip to content

Commit 5a95504

Browse files
committed
Bump @fastify/otel to 0.6.0
1 parent 60fe4e5 commit 5a95504

File tree

4 files changed

+18
-249
lines changed

4 files changed

+18
-249
lines changed

packages/node/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"access": "public"
6666
},
6767
"dependencies": {
68-
"@fastify/otel": "onurtemizkan/otel#fastify-types",
68+
"@fastify/otel": "0.6.0",
6969
"@opentelemetry/api": "^1.9.0",
7070
"@opentelemetry/context-async-hooks": "^1.30.1",
7171
"@opentelemetry/core": "^1.30.1",
@@ -101,8 +101,7 @@
101101
"import-in-the-middle": "^1.13.0"
102102
},
103103
"devDependencies": {
104-
"@types/node": "^18.19.1",
105-
"fastify": "^5.3.1"
104+
"@types/node": "^18.19.1"
106105
},
107106
"scripts": {
108107
"build": "run-p build:transpile build:types",

packages/node/rollup.npm.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export default [
3737
},
3838
}),
3939
],
40-
external: ['fastify'],
4140
},
4241
}),
4342
),

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import FastifyOtelInstrumentation from '@fastify/otel';
2-
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
1+
import { FastifyOtelInstrumentation } from '@fastify/otel';
2+
import type { FastifyInstance, FastifyReply, FastifyRequest } from './types';
33
import {
44
SEMANTIC_ATTRIBUTE_SENTRY_OP,
55
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
@@ -77,7 +77,8 @@ export const instrumentFastify = generateInstrumentOnce(INTEGRATION_NAME, () =>
7777
});
7878
});
7979

80-
return fastifyOtelInstrumentationInstance;
80+
// Returning this as any not to deal with the internal types of the FastifyOtelInstrumentation
81+
return fastifyOtelInstrumentationInstance as any;
8182
});
8283

8384
const _fastifyIntegration = (() => {
@@ -207,7 +208,7 @@ function instrumentClient(): void {
207208
}
208209

209210
function instrumentOnRequest(fastify: FastifyInstance): void {
210-
fastify.addHook('onRequest', async (request: FastifyRequest, _reply) => {
211+
fastify.addHook('onRequest', async (request: FastifyRequest & { opentelemetry?: () => { span?: Span } }, _reply) => {
211212
if (request.opentelemetry) {
212213
const { span } = request.opentelemetry();
213214

0 commit comments

Comments
 (0)