-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crysmags/ Adding support for Undici (#4293)
* Adding support Undici's fetch
- Loading branch information
Showing
13 changed files
with
612 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ declare -a plugins=( | |
"restify" | ||
"router" | ||
"tedious" | ||
"undici" | ||
"when" | ||
"winston" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
|
||
const { | ||
addHook | ||
} = require('./helpers/instrument') | ||
const shimmer = require('../../datadog-shimmer') | ||
|
||
const tracingChannel = require('dc-polyfill').tracingChannel | ||
const ch = tracingChannel('apm:undici:fetch') | ||
|
||
const { createWrapFetch } = require('./helpers/fetch') | ||
|
||
addHook({ | ||
name: 'undici', | ||
versions: ['^4.4.1', '5', '>=6.0.0'] | ||
}, undici => { | ||
return shimmer.wrap(undici, 'fetch', createWrapFetch(undici.Request, ch)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict' | ||
|
||
const FetchPlugin = require('../../datadog-plugin-fetch/src/index.js') | ||
|
||
class UndiciPlugin extends FetchPlugin { | ||
static get id () { return 'undici' } | ||
static get prefix () { | ||
return 'tracing:apm:undici:fetch' | ||
} | ||
} | ||
|
||
module.exports = UndiciPlugin |
Oops, something went wrong.