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

fastify parent-child relationship of middleware and request handler is wrong #2092

Open
AbhiPrasad opened this issue Apr 11, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@AbhiPrasad
Copy link
Member

AbhiPrasad commented Apr 11, 2024

What version of OpenTelemetry are you using?

"@opentelemetry/api": "1.7.0",
"@opentelemetry/context-async-hooks": "1.21.0",
"@opentelemetry/core": "1.21.0",
"@opentelemetry/instrumentation": "0.48.0",
"@opentelemetry/instrumentation-fastify": "0.33.0",

What version of Node are you using?

Node v21.6.2

What did you do?

Using default fastify instrumentation as per https://github.com/getsentry/sentry-javascript/blob/f6a3e026ac7f04eec78495a14c0c68f9e553e22d/packages/node/src/integrations/tracing/fastify.ts#L8-L23

What did you expect to see?

parent spans fully encapsulate their children.

What did you see instead?

image

The middleware spans end early (they only time middleware logic itself), which means that the child request handler span is longer than it's parent. I would expect middleware spans to contain the request handler in entirely, or the request handler to be parent under http server request span directly.

Additional context

@raphael-theriault-swi
Copy link
Contributor

Related to #2022

@AbhiPrasad
Copy link
Member Author

AbhiPrasad commented Apr 11, 2024

If the SIG feels like the fix is to just adjust the middleware/handler spans duration/end timestamps, happy to help with a PR (can take a look at express as well). Just need to be pointing in right direction here 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants