-
Notifications
You must be signed in to change notification settings - Fork 309
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 and http2 #3012
Fix: router and http2 #3012
Conversation
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.
Good catch. Do you think you could add a test to confirm this solves the issue?
Done. Updated PR to add tests. Took quite bit of time to figure out that the http2 plugin wasn't getting instrumented, and then another incorrect rabbit hole of creating an http2 agent before realizing that wasn't needed. It should all be working now though. |
@@ -0,0 +1,167 @@ | |||
'use strict' |
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.
Can both tests be merged with just a parameter of which HTTP module to use? Otherwise this is a lot of duplication.
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.
Yeah, should be able to do something like:
const tests = [
{ name: 'http', createServer () { /* ... / } },
{ name: 'http2', createServer () { / ... */ } },
]
for (const { name, createServer } of tests) {
describe(name, () => {
// use createServer wherever needed, and add the tests...
})
}
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.
I don't think this is a good idea.
The actual implementation of the tests are slightly different, so there'd end up being if statements in 'em anyways.
For http2, fetch-h2 is being used as the client, as axios doesn't support http2. And the URLs being passed to fetch-h2 start with http2://, so that it knows we're dealing with a http2 clearText request
so even though the test names are the same, and the expectations are similar, how the data is fetched is different.
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.
Why not just use an HTTP client that supports both? Then this becomes a non-issue and both tests can be merged.
@shahmirn is this PR something you're still interested in working on? If not I can close it for now. |
@tlhunter Nope; closing it out. |
What does this PR do?
We recently experimented with switching our express server to http2, and noticed that we weren't seeing a breakdown of the express requests under APM > Services anymore.
Dug into the code, and it looks like it's simply because the router plugin wasn't listening for the http2 server's requests finishing?
This PR should hopefully fix that issue?
Motivation
Plugin Checklist
Additional Notes