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

fix(express): span name if middleware on nested router is used #2682

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RigoTamas
Copy link

Which problem is this PR solving?

Short description of the changes

  • A flag is passed down in the storeLayerPath function, which tells the caller wether a new item has been added to the layer store. This is needed, because we only want to pop from the req[_LAYERS_STORE_PROPERTY] list if we added something to it. Popping from this list in case we did not push anything to it will result in popping a parent entry, which will skew the layers store. Hence this unnecessary popping will result in a malformed http.route tag.
  • This can be reproduced by adding a middleware to a nested router.
  • The nested router unit test has been updated to reflect this behavior. The unit test now breaks without this change, which reflects the need for this change.

@RigoTamas RigoTamas requested a review from a team as a code owner January 27, 2025 18:32
Copy link

linux-foundation-easycla bot commented Jan 27, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

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

Successfully merging this pull request may close these issues.

@opentelemetry/instrumentation-express - incorrect route set to span, if middlewares are being used
3 participants