Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

express instrumentation - span end prematurely for non-middleware instrumentations #2442

Open
2 tasks done
jzhou7-atl opened this issue Sep 21, 2024 · 0 comments
Open
2 tasks done

Comments

@jzhou7-atl
Copy link

jzhou7-atl commented Sep 21, 2024

  • This only affects the JavaScript OpenTelemetry library
  • This may affect other libraries, but I would like to get opinions here first

Hi, I want to verify if this is a bug or intended behavior of the current instrumentation code.
I notice in the instrumentation code: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts#L236-L242

The span is ended right after it is created unless it's a middleware. It does not even measure the sync execution time of the actual handler.

Should it be put after this line to measure the original handle execution time? https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts#L285

I ran a few tests, the time measured for 'request handler' is extremely short, only a couple of microseconds.

Much appreciated for looking into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant