Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃檹馃徎 Understanding Performance Implications of the NPM Installation Method #2679

Open
dannyrb opened this issue Apr 1, 2024 · 2 comments

Comments

@dannyrb
Copy link

dannyrb commented Apr 1, 2024

馃憢馃徎 Hello!

The DataDog Docs have a nice section on "Choosing the Right Installation Method" for this library. The NPM Installation method has this description:

npm (node package manager)
This method is recommended for modern web applications. The RUM Browser SDK is packaged with the rest of your front-end JavaScript code. It has no impact on page load performance. However, the SDK may miss errors, resources, and user actions triggered before the SDK is initialized. Datadog recommends using a matching version with the Browser Logs SDK.

I am hoping to understand how the claim "It has no impact on page load performance." is achieved. I had assumed that the library's source code would be baked into an application's bundle, but it looks like there may be some strategy in place to defer it's loading?

Apologies in advance if this is a naive question -- just hoping to learn and understand.

@dannyrb dannyrb changed the title Understanding Performance Implications of the NPM Installation Method 馃檹馃徎 Understanding Performance Implications of the NPM Installation Method Apr 2, 2024
@BenoitZugmeyer
Copy link
Member

馃憢

I agree the documentation is a bit misleading. There might be an impact depending on how you are bundling the SDK code inside your application. If it's in a JS bundle that is loaded on page load, then it will probably have an impact on the page load performance, since your app will need to download the extra code.

I will see if we can find a better wording in the documentation.

@dannyrb
Copy link
Author

dannyrb commented Apr 8, 2024

Ah! Thank you. I appreciate the clarification!

We're eyeing the appropriate installation method, and noticed a slight performance decrease (for LCP) when switching to the NPM solution. It looks like it might still be the right choice, but that we'll have to experiment with how/when it's loaded when using NPM outside of the default guidance.

Update: We had some luck following DataDog's existing Next.js guidance, but then also Lazy Loading the component with SSR disabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants