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({