DataDog / browser-sdk

Datadog Browser SDK
Apache License 2.0
305 stars 136 forks source link

Support RUM work on Web-Worker #2949

Open miridih-chyoon opened 3 months ago

miridih-chyoon commented 3 months ago

Hello,

In our project, moving GA-related operations to WebWorker has resulted in many performance improvements. Datadog's RUM also seems to be using a lot of resources in the browser. Is it possible to improve the RUM or logging related logic to work in WebWorker? In Next.js, we use Partytown to make GTM work with Web-Worker, which improves performance.

BenoitZugmeyer commented 2 months ago

Hello,

The RUM Browser SDK collects a lot of data from APIs only available in the main thread global scope. Running the whole SDK inside a WebWorker would not work.

That being said, the SDK is already running some code in a Web Worker to avoid impacting the main thread for some operations.

Did you observe any specific part of the RUM SDK that "uses a lot of resources"? If you can share a Chrome profile we might be able to investigate and improve it.