I was following up on trying to use OpenTelemetry-JS in Deno (after my earlier efforts here) this time trying to export trace data out of Deno and to an OTEL collector.
The main issue I ran into this time was that the browser version of the exporter relies on either navigator.sendBeacon or XmlHttpRequest to do the exporting, neither of which are currently available in Deno.
I was able to put together this small userland polyfill of navigator.sendBeacon based on this comment from MDN about the "keepalive" option for fetch, which seemed to do the trick as far as my OTEL-JS experiment goes. However I'm not sure if its description there as a "drop-in replacement for navigator.sendBeacon" also applies in Deno.
I remember seeing elsewhere XmlHttpRequest won't be supported in core, but I was curious if the same would apply to navigator.sendBeacon? I'm not quite sure what the direction is around navigator APIs, as I see there seem to only be 2 supported at the moment (?) so I figured it couldn't hurt to ask.
I was following up on trying to use OpenTelemetry-JS in Deno (after my earlier efforts here) this time trying to export trace data out of Deno and to an OTEL collector.
The main issue I ran into this time was that the browser version of the exporter relies on either navigator.sendBeacon or XmlHttpRequest to do the exporting, neither of which are currently available in Deno.
I was able to put together this small userland polyfill of navigator.sendBeacon based on this comment from MDN about the "keepalive" option for fetch, which seemed to do the trick as far as my OTEL-JS experiment goes. However I'm not sure if its description there as a "drop-in replacement for navigator.sendBeacon" also applies in Deno.
I remember seeing elsewhere XmlHttpRequest won't be supported in core, but I was curious if the same would apply to navigator.sendBeacon? I'm not quite sure what the direction is around navigator APIs, as I see there seem to only be 2 supported at the moment (?) so I figured it couldn't hurt to ask.