Skip to content

Commit d052a1b

Browse files
committed
fix(fastify): Make sure consturctor patching works with esm
1 parent 4f11245 commit d052a1b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,13 @@ export class FastifyInstrumentation extends InstrumentationBase {
198198
}
199199

200200
private _patchConstructor(
201-
original: () => FastifyInstance
202-
): () => FastifyInstance {
201+
moduleExports: { fastify: () => FastifyInstance },
202+
): () => FastifyInstance {
203203
const instrumentation = this;
204204
this._diag.debug('Patching fastify constructor function');
205205

206206
function fastify(this: FastifyInstance, ...args: any) {
207-
const app: FastifyInstance = original.apply(this, args);
207+
const app: FastifyInstance = moduleExports.fastify.apply(this, args);
208208
app.addHook('onRequest', instrumentation._hookOnRequest());
209209
app.addHook('preHandler', instrumentation._hookPreHandler());
210210

0 commit comments

Comments
 (0)