@@ -56,7 +56,7 @@ export const instrumentFastify = generateInstrumentOnce(INTEGRATION_NAME, () =>
56
56
// FastifyOtelInstrumentation does not have a `requestHook`
57
57
// so we can't use `addFastifySpanAttributes` here for now
58
58
fastifyOtelInstrumentationInstance = new FastifyOtelInstrumentation ( {
59
- // registerOnInitialization: true,
59
+ registerOnInitialization : true ,
60
60
} ) ;
61
61
return fastifyOtelInstrumentationInstance ;
62
62
} ) ;
@@ -151,29 +151,6 @@ export function setupFastifyErrorHandler(fastify: FastifyInstance): void {
151
151
} ) ;
152
152
}
153
153
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
-
177
154
// eslint-disable-next-line @typescript-eslint/no-floating-promises
178
155
fastify . register ( plugin ) ;
179
156
}
0 commit comments