@@ -56,7 +56,7 @@ export const instrumentFastify = generateInstrumentOnce(INTEGRATION_NAME, () =>
5656 // FastifyOtelInstrumentation does not have a `requestHook`
5757 // so we can't use `addFastifySpanAttributes` here for now
5858 fastifyOtelInstrumentationInstance = new FastifyOtelInstrumentation ( {
59- // registerOnInitialization: true,
59+ registerOnInitialization : true ,
6060 } ) ;
6161 return fastifyOtelInstrumentationInstance ;
6262} ) ;
@@ -151,29 +151,6 @@ export function setupFastifyErrorHandler(fastify: FastifyInstance): void {
151151 } ) ;
152152 }
153153
154- // // Need to check because the @fastify /otel's plugin crashes the app in the runtime
155- // // if the version is not supported
156- // let fastifyVersion = fastify.version ? parseSemver(fastify.version) : undefined;
157-
158- // if (!fastifyVersion) {
159- // // try reading the version from the package.json
160- // try {
161- // // eslint-disable-next-line @typescript-eslint/no-var-requires
162- // const pkg = require('fastify/package.json');
163- // if (pkg?.version) {
164- // fastifyVersion = parseSemver(pkg.version);
165- // }
166- // } catch {
167- // // ignore
168- // }
169- // }
170-
171- // if (fastifyOtelInstrumentationInstance?.isEnabled() && fastifyVersion?.major && fastifyVersion.major >= 4) {
172- // // Can't use `await` here
173- // // eslint-disable-next-line @typescript-eslint/no-floating-promises
174- // fastify.register(fastifyOtelInstrumentationInstance?.plugin());
175- // }
176-
177154 // eslint-disable-next-line @typescript-eslint/no-floating-promises
178155 fastify . register ( plugin ) ;
179156}
0 commit comments