[Feature Request] Provide an override option for the Sender
Proposal: Port over the IXhrOverride interfaces to allow the replacing of the sending logic
/**
- SendPOSTFunction type defines how an HTTP POST request is sent to an ingestion server
- @param payload - The payload object that should be sent, contains the url, bytes/string and headers for the request
- @param oncomplete - The function to call once the request has completed whether a success, failure or timeout
- @param sync - A boolean flag indicating whether the request should be sent as a synchronous request. */ export type SendPOSTFunction = (payload: IPayloadData, oncomplete: (status: number, headers: { [headerName: string]: string; }, response?: string) => void, sync?: boolean) => void;
/**
- The IXHROverride interface overrides the way HTTP requests are sent.
/
export interface IXHROverride {
/*
- This method sends data to the specified URI using a POST request. If sync is true,
- then the request is sent synchronously. The oncomplete function should always be called after the request is
- completed (either successfully or timed out or failed due to errors). */ sendPOST: SendPOSTFunction; }
The VS Code extension telemetry module currently ships with both App insights and 1DS support to support both 1st and 3rd party extensions. We noticed that this package is quite large ~200 kb and shipped with every extension often accounting for 200kb of the bundle size. While 1DS is quite small the AI node module takes up a large chunk of this service even though we utilize a small amount of it. We have since switched to the AI web basic SKU and would love to supply an XHR polyfill similar to 1DS without polluting the global namespace in order to keep our bundle size small.