When an app calls fetch(new Request(...)), the OTel fetch instrumentation
hands our hook the Request object itself. Its body is a stream that the
network layer has already consumed by the time the hook runs, so there is
nothing left to read. Wrap window.fetch so a clone of the body is read
up front and can be looked up by Request identity later.
Requests to urlBlocklist endpoints (auth and token exchanges by default)
are never copied, matching the XHR capture; their spans are marked
not-to-record later anyway, so the copy would only sit in memory.
Install after registerInstrumentations so this sits on top of the OTel
wrapper. Returns a function that removes the wrapper.
When an app calls
fetch(new Request(...)), the OTel fetch instrumentation hands our hook the Request object itself. Its body is a stream that the network layer has already consumed by the time the hook runs, so there is nothing left to read. Wrapwindow.fetchso a clone of the body is read up front and can be looked up by Request identity later.Requests to
urlBlocklistendpoints (auth and token exchanges by default) are never copied, matching the XHR capture; their spans are marked not-to-record later anyway, so the copy would only sit in memory.Install after
registerInstrumentationsso this sits on top of the OTel wrapper. Returns a function that removes the wrapper.