DataDog / browser-sdk

Datadog Browser SDK
Apache License 2.0
279 stars 130 forks source link

🙏 "Reached max sessionReplay events size queued for upload: 3MiB" meaning #2820

Open namelivia opened 2 weeks ago

namelivia commented 2 weeks ago

We are seeing instances of Reached max sessionReplay events size queued for upload: 3MiB an error that was added here: https://github.com/DataDog/browser-sdk/pull/1716.

I have not been able to find references to this message in the documentation, from the PR description and the contents of the message itself I guess the agent is generating more events that it can upload.

What implications does this have? Do events over the limit get lost? Is this limit fixed or can be changed? Is there any way to control the number of generated events so we don't hit this limit?

Thanks!

amortemousque commented 4 days ago

Hello @namelivia,

If the sending of a request fails for any reason (network failure, intake unavailable, no connectivity…) we will queue the request and try to resend it later. The requests are also throttled if there are too many in progress, to prevent exhausting the end-user bandwidth.

The SDK queue at most 3MB of requests above which the oldest requests are dropped. The limit is fixed and can't be changed for now. They have been made to preserve the end user experience.

Reaching the limit is not a problem in itself, as it can be because of a poor network condition of the end-user which is an intended behavior. However, if you see this message on good network condition for most of the page load, it can be due to a large HTML DOM or stylesheet present in the page. That can potentially be mitigated by only loading the necessary CSS StyleSheet or lazy loading parts of the HTML DOM.