Problem
The SDK supports custom telemetry dispatchers through the dispatcher config option:
dispatcher?: { dispatch: (event: any) => void };
However, custom dispatchers may perform async work such as calling fetch, writing to IndexedDB, or pushing telemetry to a queue.
Currently, TelemetrySyncManager calls the custom dispatcher without await in both the normal sync path and the retry path:
this._config.dispatcher.dispatch(telemetryObj);
If the custom dispatcher returns a rejected Promise, the surrounding try/catch will not catch the failure. This can cause the SDK to treat the dispatch as successful and skip the existing failed-batch retry handling.
Expected behavior
Async custom dispatcher failures should be handled the same way as failures from the default dispatcher:
- rejected async dispatches should be caught,
- failed batches should be added to the failed batch queue,
- retry logic should be triggered.
Suggested fix
- Update the custom dispatcher type to allow
void | Promise<unknown>.
- Await custom dispatcher calls in both normal sync and retry sync paths.
- Add a regression test for rejected async custom dispatchers.
Problem
The SDK supports custom telemetry dispatchers through the
dispatcherconfig option:However, custom dispatchers may perform async work such as calling
fetch, writing to IndexedDB, or pushing telemetry to a queue.Currently,
TelemetrySyncManagercalls the custom dispatcher withoutawaitin both the normal sync path and the retry path:If the custom dispatcher returns a rejected Promise, the surrounding
try/catchwill not catch the failure. This can cause the SDK to treat the dispatch as successful and skip the existing failed-batch retry handling.Expected behavior
Async custom dispatcher failures should be handled the same way as failures from the default dispatcher:
Suggested fix
void | Promise<unknown>.