You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using aws-xray-sdk-fetch to trace HTTPS requests that goes outside AWS.
My application (AWS Lambda) also uses the AWS AppConfig Agent client via another fetch call to localhost.
When using captureFetchGlobal, all fetch calls are being traced—including AppConfig Agent's localhost requests.
Expected Behavior
I would like to only trace external fetch calls and not trace localhost calls.
Current Behavior
With captureFetchGlobal, the global fetch is wrapped, causing all fetch requests to be traced, including those to localhost.
import{captureFetchGlobal}from"aws-xray-sdk-fetch";constfetch=captureFetchGlobal();exportdefaultasyncfunctionsend(url,body){// ✅ I want to trace this fetchconstresponse=awaitfetch(url,{method : "POST",body : JSON.stringify(body),headers : {"Content-Type" : "application/json"}});if(!response.ok){thrownewError(`${response.statusText} (${response.statusCode})`);}}
In another function:
exportdefaultasyncfunctiongetAppConfigLatestJson(){// ❌ I do NOT want to trace this fetchconstresponse=awaitfetch(url);returnawaitresponse.json();}
Issue
The captureFetchGlobal function returns a specific fetch function but still wraps the global fetch object. This behavior is counterintuitive, as I expected only the assigned fetch to be traced.
How to only trace the first fetch?
Suggested Improvement
It would be helpful if captureFetchGlobal could:
Avoid mutating the global fetch in an additional captureFetchStandalone function and return a wrapped instance that can be selectively used.
Alternatively, provide an option to filter which requests to trace (e.g., by hostname or URL pattern).
The text was updated successfully, but these errors were encountered:
I'm using aws-xray-sdk-fetch to trace HTTPS requests that goes outside AWS.
My application (AWS Lambda) also uses the AWS AppConfig Agent client via another
fetch
call tolocalhost
.When using
captureFetchGlobal
, allfetch
calls are being traced—including AppConfig Agent'slocalhost
requests.Expected Behavior
I would like to only trace external
fetch
calls and not tracelocalhost
calls.Current Behavior
With
captureFetchGlobal
, the globalfetch
is wrapped, causing allfetch
requests to be traced, including those tolocalhost
.In another function:
Issue
The
captureFetchGlobal
function returns a specificfetch
function but still wraps the globalfetch
object. This behavior is counterintuitive, as I expected only the assignedfetch
to be traced.How to only trace the first
fetch
?Suggested Improvement
It would be helpful if
captureFetchGlobal
could:fetch
in an additionalcaptureFetchStandalone
function and return a wrapped instance that can be selectively used.The text was updated successfully, but these errors were encountered: