From 97929c720477760bb95a4bcd2310b587aae9a282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?San=20=27rdn=27=20M=C3=B4nico?= Date: Sun, 7 Jan 2024 20:10:04 -0300 Subject: [PATCH] fix: span emit warnings on express instrumentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: San 'rdn' Mônico --- .../src/instrumentation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts index 46fd4cc0ff..bb29f52cbf 100644 --- a/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts @@ -280,7 +280,7 @@ export class ExpressInstrumentation extends InstrumentationBase< const isError = ![undefined, null, 'route', 'router'].includes( maybeError ); - if (isError) { + if (!spanHasEnded && isError) { const [error, message] = asErrorAndMessage(maybeError); span.recordException(error); span.setStatus({