ApplicationInsights-JS
ApplicationInsights-JS copied to clipboard
Add a callback/event to notify that the SDK failed to send telemetry data
Add callbacks for onSuccess and onError.
I can see at least two ways how this could be implemented:
1: Adding an extra parameter to the track* calls, like trackEvent("MyEvent", myProps, { onSuccess: handleSuccess });. This way the user could be notified about every single telemetry item separately.
2: Adding global event handlers to the appInsights object: appInsights.addEventListener("sendSucceeded", handleSuccess);. This way the user gets to know whether telemetry sending works in general, and the onSuccess callback might even imply that the sending queue exhausted.
I personally prefer the second one, it would solve my current problem in #313.