instrument fetch()
Node v18.0.0 (https://nodejs.org/en/blog/announcements/v18-release-announce/) brings a global fetch() implementation (https://nodejs.org/api/all.html#all_globals_fetch). Can we instrument that?
The node fetch() impl is, at least originally, based on undici, for which we have a separate issue: https://github.com/elastic/apm-agent-nodejs/issues/2383
Node v18.0.0 also introduces experimental WebStreams support: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
I'm not sure how necessarily tied together fetch() and web streams will be for our instrumentation. In particular the web streams docs talk about being able to cancel a fetch. Presumably just wrapping the Promise returned from fetch() is sufficient to instrument its completion, but I haven't grokked ReadableStream.cancel() yet.
fetch() is now instrumented in [email protected] (release notes) by https://github.com/elastic/apm-agent-nodejs/issues/2383