ApplicationInsights-JS icon indicating copy to clipboard operation
ApplicationInsights-JS copied to clipboard

Add a callback/event to notify that the SDK failed to send telemetry data

Open KamilSzostak opened this issue 9 years ago • 1 comments

Add callbacks for onSuccess and onError.

KamilSzostak avatar Aug 16 '16 16:08 KamilSzostak

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.

sorgloomer avatar Sep 13 '16 18:09 sorgloomer