Skip to content

[rum] Inject browser sdk #119

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Feb 27, 2025
Merged

[rum] Inject browser sdk #119

merged 19 commits into from
Feb 27, 2025

Conversation

yoannmoinet
Copy link
Member

@yoannmoinet yoannmoinet commented Nov 29, 2024

What and why?

Automatically inject RUM's Browser SDK into the bundle.

How?

  • Implement the RUM plugin and add tests.
    • It also publishes a new file alongside our bundler plugins rum-browser-sdk.js which is used for the injection.
  • Also update the README construction to include a bit more from the sub plugins' readmes.

TODO

  • Test RUM's SDK in real life situation.

@yoannmoinet yoannmoinet linked an issue Nov 29, 2024 that may be closed by this pull request
@yoannmoinet yoannmoinet self-assigned this Nov 29, 2024
@yoannmoinet yoannmoinet changed the base branch from master to yoann/move-sourcemaps November 29, 2024 15:32
@yoannmoinet yoannmoinet force-pushed the yoann/inject-browser-sdk branch 2 times, most recently from 47ec98f to 73486c7 Compare December 2, 2024 10:20
@yoannmoinet yoannmoinet force-pushed the yoann/inject-browser-sdk branch from a305acd to fceab29 Compare December 9, 2024 15:29
@yoannmoinet yoannmoinet changed the base branch from yoann/move-sourcemaps to yoann/add-more-injection-points December 9, 2024 15:29
@yoannmoinet yoannmoinet force-pushed the yoann/inject-browser-sdk branch from fceab29 to 3c35484 Compare December 9, 2024 16:35
@yoannmoinet yoannmoinet force-pushed the yoann/add-more-injection-points branch from 84950be to 74d2575 Compare January 14, 2025 14:23
@yoannmoinet yoannmoinet force-pushed the yoann/inject-browser-sdk branch 2 times, most recently from e401db0 to d66990f Compare January 16, 2025 10:05
@yoannmoinet yoannmoinet changed the base branch from yoann/add-more-injection-points to yoann/better-sandbox-tests January 16, 2025 10:05
@yoannmoinet yoannmoinet force-pushed the yoann/inject-browser-sdk branch from d66990f to 5f3ea86 Compare January 16, 2025 13:55
@yoannmoinet yoannmoinet changed the base branch from yoann/better-sandbox-tests to yoann/lighten-readmes January 16, 2025 13:55
Base automatically changed from yoann/lighten-readmes to master February 6, 2025 21:40
@yoannmoinet yoannmoinet changed the base branch from master to yoann/v2.5.0 February 10, 2025 15:08
@yoannmoinet yoannmoinet mentioned this pull request Feb 11, 2025
@yoannmoinet yoannmoinet force-pushed the yoann/inject-browser-sdk branch from 5f3ea86 to f158564 Compare February 11, 2025 16:19
@yoannmoinet yoannmoinet changed the base branch from yoann/v2.5.0 to yoann/add-e2e-testing February 11, 2025 16:19
@yoannmoinet yoannmoinet marked this pull request as ready for review February 12, 2025 08:55
README.md Outdated
datadogWebpackPlugin({
rum?: {
disabled?: boolean,
sdk?: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could use the RUM type directly here, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very good idea, I'll check if I can.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put that on the wrong file, oops, this is the README, not the source types

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah nice Idea!

Comment on lines 14 to 16
- [rum.sdk.applicationId](#rumsdkapplicationid)
- [rum.sdk.clientToken](#rumsdkclienttoken)
- [rum.sdk.site](#rumsdksite)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, maybe we don't need to document all of those. Instead we could reference the general doc in the public documentation website, WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I'm afraid of getting out of sync, but I do prefer having a single source of truth.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want only 1 source of truth, you'd need to add a dependency on @datadog/browser-rum instead of checking the global DD_RUM (right now you're only using a devDep)

Comment on lines +14 to +16
DD_RUM.addAction('custom_click', {
bundler: '{{bundler}}',
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️


import { datadogRum } from '@datadog/browser-rum';

// To please TypeScript.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

@yoannmoinet yoannmoinet requested a review from jakub-g February 13, 2025 10:58
@yoannmoinet yoannmoinet force-pushed the yoann/inject-browser-sdk branch 2 times, most recently from 68f129f to 378742a Compare February 13, 2025 14:05
Base automatically changed from yoann/v2.5.0 to master February 13, 2025 14:32
@yoannmoinet yoannmoinet force-pushed the yoann/inject-browser-sdk branch from 378742a to d8d6d43 Compare February 17, 2025 08:47
@jakub-g jakub-g removed their request for review February 18, 2025 09:16
@yoannmoinet yoannmoinet force-pushed the yoann/inject-browser-sdk branch from d8d6d43 to 8784499 Compare February 21, 2025 16:22
Comment on lines -126 to -127
- run: yarn typecheck:all

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done part of the yarn cli integrity now.

@yoannmoinet yoannmoinet merged commit 3c307f3 into master Feb 27, 2025
4 checks passed
@yoannmoinet yoannmoinet deleted the yoann/inject-browser-sdk branch February 27, 2025 08:59
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

Successfully merging this pull request may close these issues.

Implement RUM's Browser SDK injection
4 participants