-
Notifications
You must be signed in to change notification settings - Fork 176
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 Router.match pathAndMethod to only include layers that have methods #106
base: master
Are you sure you want to change the base?
Conversation
@Gary-Osteen-Q2 Thanks for submitting a PR to fix #105. I have reviewed the changes. Just need a collaborator to review now. @niftylettuce do you have time to have a look at this? Let me know if there is anything I missed in my review, I am still new to this 😄 |
Can anyone take some time to look this over? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gary-Osteen-Q2: Congratulations on your first open source contribution. You included tests and these changes look good to me. I will be building against your branch while I work on some Open Telemetry improvements.
@niftylettuce: I believe this PR may be required to address this upstream issue: |
@jmealo Thanks! I've always looked forward to giving back to open source eventually. I am elated to think that it might also fix some upstream issues! |
Sorry I dropped the ball on this, is this ready to go? Can a few people look over this and ping me back? |
@niftylettuce it is ready to go from code side. I don't know what else would be needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gary-Osteen-Q2, thank you for your efforts.
I think it's better to keep "path" over "pathOnly" as var/prop name. just for make the update smooth.
@3imed-jaberi I'm not sure I follow how it would make the update smooth. Logically the layer that gets added to pathOnly have no methods to match in the first place. Whereas pathNotMethod the layer did have a method and it didn't match. Path would then be too generic to me as I would expect others to come in and think that the path matched everything. |
We should aim not to break this, which checks the |
@jmealo pathOnly is used internally by Router.prototype.match which is a @Private method. No outside project should be looking at that variable directly. The ctx.matched gets set at the same place as before in Router.prototype.routes. I don't see how this should affect any other dependent project. Inside Router.prototype.routes the path and ctx.path are unchanged. |
@Gary-Osteen-Q2: Sorry for my delayed reply. Your reasoning on a As @3imed-jaberi: pointed out that this PR as implemented would need a I saw an actual monkey patch in the wild that wrapped internal methods of koa-router to set the operation name to the route on outgoing telemetry because there was no way to do it with the public API. npm is full of instrumentation libraries that monkey patch "private" methods. Instrumentation developers can't really wait/lobby for each upstream projects to change the public API to expose its internals for what they'll consider a niche use case and their users needed better instrumentation yesterday. Since JavaScript doesn't have TLDR: @niftylettuce If we change the |
@JacobMGEvans @Gary-Osteen-Q2 I think it is inferred that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in next bump release
@Gary-Osteen-Q2 can you please rebase with the master branch to resolve the conflict and go on here |
@Gary-Osteen-Q2 could you please rebase with the latest release main changes, I will take care to ship this fix on your next release whatever major or minor release ;) ! |
26805e9
to
057c50a
Compare
Fix #105