-
Notifications
You must be signed in to change notification settings - Fork 98
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: force http and https clients to be patched #1084
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.
I see the change, and I see that it fixes an issue with tracing of node-fetch
, however, I don't see an explanation for why existing code wasn't working and why the change here fixes it. Can you include background on what the bug was and elaborate on why force-loading http
and https
fixes it?
Codecov Report
@@ Coverage Diff @@
## master #1084 +/- ##
==========================================
+ Coverage 94.93% 94.96% +0.03%
==========================================
Files 96 98 +2
Lines 6397 6441 +44
Branches 498 499 +1
==========================================
+ Hits 6073 6117 +44
Misses 166 166
Partials 158 158
Continue to review full report at Codecov.
|
Requests from
node-fetch
currently might not get traced, because we use it in the Trace Agent (for authentication). Because it's loaded in the Trace Agent before we set up monkeypatching, we don't have a way to hook into its require ofhttp
orhttps
. Therefore, forhttp
, if it's the only module to be included that would requirehttp
, thenhttp
will never get patched, and HTTP requests will never get traced. The same is independently true ofhttps
. (Common HTTP frameworks will typically requirehttp
, alleviating this problem for HTTP requests. However, in a Cloud Functions environment, this might not apply, as even the HTTP framework is required before the Trace Agent has a chance to set up monkeypatching.)We address this simply by requiring
http
andhttps
when the Trace Agent starts.Fixes #1081