From 40997fca0f4ad44c5aff2c38e57b1d9151a4314e Mon Sep 17 00:00:00 2001 From: Tom Smithhisler Date: Wed, 8 Jan 2025 16:52:51 -0500 Subject: [PATCH] fix(instrumentation-fastify): add missing module export fastify v4.x+ exports an object named `errorCodes` as both a property of the default export and as a named export. The export is documented at https://github.com/fastify/fastify/blob/4.x/docs/Reference/Errors.md?plain=1#L236. This closes #2027. --- .../src/instrumentation.ts | 3 +++ .../test/instrumentation.test.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts index 72d8b8c9b7..32fc01dd46 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts @@ -27,6 +27,7 @@ import type { FastifyInstance, FastifyRequest, FastifyReply, + FastifyErrorCodes, } from 'fastify'; import { hooksNamesToWrap } from './constants'; import { @@ -185,6 +186,7 @@ export class FastifyInstrumentation extends InstrumentationBase FastifyInstance; + errorCodes: FastifyErrorCodes; }): () => FastifyInstance { const instrumentation = this; @@ -198,6 +200,7 @@ export class FastifyInstrumentation extends InstrumentationBase { }, }); }); + + it('should expose errorCodes', async () => { + assert.ok(Fastify.errorCodes); + }) });