diff --git a/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts index fcaf3114e6..fd6aaa89c4 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts @@ -197,14 +197,14 @@ export class FastifyInstrumentation extends InstrumentationBase { }; } - private _patchConstructor( - original: () => FastifyInstance - ): () => FastifyInstance { + private _patchConstructor(moduleExports: { + fastify: () => FastifyInstance; + }): () => FastifyInstance { const instrumentation = this; this._diag.debug('Patching fastify constructor function'); function fastify(this: FastifyInstance, ...args: any) { - const app: FastifyInstance = original.apply(this, args); + const app: FastifyInstance = moduleExports.fastify.apply(this, args); app.addHook('onRequest', instrumentation._hookOnRequest()); app.addHook('preHandler', instrumentation._hookPreHandler());