aws-xray-sdk-fetch
Advanced tools
Comparing version 3.10.1 to 3.10.2
@@ -20,1 +20,7 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
export function enableCapture<Fetch, Request>( | ||
fetch: Fetch, | ||
request: Request, | ||
downstreamXRayEnabled?: boolean, | ||
subsegmentCallback?: (subsegment: AWSXRay.Subsegment, req: Request, res: Response | null, error?: Error | undefined) => void | ||
): Fetch; |
@@ -57,3 +57,14 @@ /** | ||
const enableCapture = function enableCapture(baseFetchFunction, requestClass, downstreamXRayEnabled, subsegmentCallback) { | ||
/** | ||
* Return a fetch function that will pass segment information to the target host. | ||
* This does not change any globals | ||
* @param {function} baseFetchFunction fetch function to use as basis | ||
* @param {function} requestClass Request class to use. This should correspond to the supplied fetch function. | ||
* @param {boolean} downstreamXRayEnabled - when true, adds a "traced:true" property to the subsegment | ||
* so the AWS X-Ray service expects a corresponding segment from the downstream service. | ||
* @param {function} subsegmentCallback - a callback that is called with the subsegment, the fetch request, | ||
* the fetch response and any error issued, allowing custom annotations and metadata to be added. | ||
* @returns Response | ||
*/ | ||
function enableCapture(baseFetchFunction, requestClass, downstreamXRayEnabled, subsegmentCallback) { | ||
@@ -120,3 +131,3 @@ const overridenFetchAsync = async (...args) => { | ||
try { | ||
response = await baseFetchFunction(...args); | ||
response = await baseFetchFunction(requestClone); | ||
@@ -164,6 +175,6 @@ if (thisSubsegmentCallback) { | ||
return overridenFetchAsync; | ||
}; | ||
} | ||
module.exports.captureFetchGlobal = captureFetchGlobal; | ||
module.exports.captureFetchModule = captureFetchModule; | ||
module.exports._fetchEnableCapture = enableCapture; | ||
module.exports.enableCapture = enableCapture; |
{ | ||
"name": "aws-xray-sdk-fetch", | ||
"version": "3.10.1", | ||
"version": "3.10.2", | ||
"description": "AWS X-Ray plugin for node-fetch", | ||
@@ -24,3 +24,3 @@ "author": "Amazon Web Services", | ||
"peerDependencies": { | ||
"aws-xray-sdk-core": "^3.10.1" | ||
"aws-xray-sdk-core": "^3.10.2" | ||
}, | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
"@types/node-fetch": "^2.6.4", | ||
"chai-as-promised": "^7.1.1", | ||
"chai-as-promised": "=7.1.1", | ||
"node-fetch": "^2.6.11", | ||
@@ -52,3 +52,3 @@ "ts-expect": "^1.3.0" | ||
}, | ||
"gitHead": "5539f1ab3a33f8df7b8add9e450b536886250a3a" | ||
"gitHead": "3b89008bb32caef55609c7e3e9f936c75545620a" | ||
} |
@@ -46,1 +46,2 @@ # fetch-xray | ||
- [Jason Terando](https://github.com/jasonterando) | ||
- [Bernd Fuhrmann](https://github.com/berndfuhrmann) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24458
224
47