@opentelemetry/instrumentation-express handler does not account for async work #2023
Labels
bug
Something isn't working
pkg:instrumentation-express
priority:p2
Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
What version of OpenTelemetry are you using?
What version of Node are you using?
v18.19.1
What did you do?
Run the included express sample https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/express
What did you expect to see?
Async work should be accounted for in the handler duration.
What did you see instead?
The handler span has very short duration, only accounting for synchronous work. This is already a known caveat documented here but I couldn't find a tracking bug.
This screenshot demonstrates the problems
Additional context
A common pattern for express is to use an async function as the handler, as demonstrated in the sample
opentelemetry-js-contrib/examples/express/src/server.ts
Line 36 in 9df30ea
For handlers that return a promise, it should be possible to chain a
span.end()
call to the promise. However this also seems related to #2022The text was updated successfully, but these errors were encountered: