-
Notifications
You must be signed in to change notification settings - Fork 293
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
Adding Unidici support #4293
base: master
Are you sure you want to change the base?
Adding Unidici support #4293
Conversation
Overall package sizeSelf size: 6.63 MB Dependency sizes
🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4293 +/- ##
==========================================
- Coverage 69.19% 67.23% -1.96%
==========================================
Files 1 245 +244
Lines 198 10415 +10217
Branches 33 33
==========================================
+ Hits 137 7003 +6866
- Misses 61 3412 +3351 ☔ View full report in Codecov by Sentry. |
7387a6e
to
8dd1be7
Compare
express = require('express') | ||
fetch = require('undici') |
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.
Should probably change these to use withVersions(...)
so we get version checking and don't need to add undici as a dev dependency.
You use it like this: https://github.com/DataDog/dd-trace-js/blob/master/packages/datadog-plugin-mysql/test/index.spec.js#L16
Then you can require
or proxyquire
it out of the versions
folder. https://github.com/DataDog/dd-trace-js/blob/master/packages/datadog-plugin-mysql/test/index.spec.js#L31
It's a bit unintuitive, but that gets us multi-version checking.
If you want to see the withVersions(...)
source to understand how it works, you can find it here: https://github.com/DataDog/dd-trace-js/blob/master/packages/dd-trace/test/setup/mocha.js#L169
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.
This is done.
f2e5643
to
b5778d1
Compare
|
||
addHook({ | ||
name: 'undici', | ||
versions: ['^4.4.1', '5', '^6.0.0'] |
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.
The last range should be >=6
so that tracing will continue to work if a user upgrades to 7.0 when it's released.
@@ -30,6 +30,7 @@ loadChannel.subscribe(({ name }) => { | |||
|
|||
// Globals | |||
maybeEnable(require('../../datadog-plugin-fetch/src')) | |||
maybeEnable(require('../../datadog-plugin-undici/src')) |
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.
This shouldn't be needed since Undici is not global like fetch
is.
607670d
to
ac424fd
Compare
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.
Looks like there's a small bit probably leftover from debugging tests, but otherwise LGTM.
it('FIRST TEST FAILS BECAUSE.', () => { | ||
}) |
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.
Leftover from test debugging? 🤔
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.
@Qard actually, it's not. There is an issue where whatever test that is first will always fail, hence this empty test. I am hoping that through review we could find a reason why/ or a more acceptable workaround.
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.
Strange. 🤔
What's the error?
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.
@Qard no error just eventually times out with
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/datadog-plugin-undici/test/index.spec.js)
b24ed9a
to
1060061
Compare
2bbaf3c
to
610d5ca
Compare
What does this PR do?
This will add support for Undici for current versions of Undici that support fetch (versions '^4.4.1', '5', '^6.0.0'). It will also support diagnostics channel when it is supported by Undici.
Plugin Checklist
Additional Notes