Skip to content

Conversation

@amortemousque
Copy link
Collaborator

@amortemousque amortemousque commented Dec 18, 2025

What and why?

This PR adds source code context injection capabilities to the RUM plugin, enabling customers to identify which microfrontend originates each RUM event in their applications. It focuses on setups with separated bundles loaded via dynamic imports (e.g., module federation) by injecting source code metadata at entry points.

How?

  • New sourceCodeContext option in RUM plugin config that accepts service and version
  • Injects minified, SSR-safe snippet that creates DD_SOURCE_CODE_CONTEXT global variable mapping stack traces to service/version metadata
  • E2E tests validating the RUM event enrichment

Usage

const { datadogWebpackPlugin } = require('@datadog/webpack-plugin');

module.exports = {
  plugins: [
    datadogWebpackPlugin({
      rum: {
        enable: true,
        sourceCodeContext: {
            service: SERVICE_NAME,
            version: SERVICE_VERSION,
        },
      },
    }),
  ],
};`

@amortemousque amortemousque force-pushed the aymeric/rum-microfrontend branch 2 times, most recently from f38fce4 to 761d68d Compare December 18, 2025 09:28
Copy link
Member

@yoannmoinet yoannmoinet left a comment

Choose a reason for hiding this comment

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

Looks super good.
Thanks for tackling this.

Do you think you could also update ownership of the plugin?

packages/plugins/rum @yoannmoinet

I mostly had small comments.

@BeltranBulbarellaDD
Copy link

Looks good!

@amortemousque amortemousque force-pushed the aymeric/rum-microfrontend branch from 761d68d to da7caff Compare January 28, 2026 14:43
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 28, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 906889e | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@amortemousque amortemousque force-pushed the aymeric/rum-microfrontend branch from da7caff to 405d4b4 Compare January 29, 2026 14:54
@amortemousque amortemousque reopened this Jan 29, 2026
@amortemousque amortemousque marked this pull request as ready for review January 29, 2026 14:55
@amortemousque amortemousque force-pushed the aymeric/rum-microfrontend branch from 70018c9 to 536f84d Compare January 29, 2026 15:38
Copy link
Member

@yoannmoinet yoannmoinet left a comment

Choose a reason for hiding this comment

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

Added some comments.
Nothing too bad.

Copy link

@BeltranBulbarellaDD BeltranBulbarellaDD left a comment

Choose a reason for hiding this comment

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

LGTM


export type SourceCodeContextOptions = {
service: string;
version?: string;
Copy link

Choose a reason for hiding this comment

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

❓ question: ‏is there a use case that we want to explicitly support with omitting version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What if you want to enrich the event with the owner (service) but don’t care about the version or unminification?
Do you think we should enforce the version to prepare customers for the unminification use case?

Copy link

Choose a reason for hiding this comment

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

hum, maybe we add could have everything optional then 🤔
And later add context in the options as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, for now the use case is ownership assignment. Since we don’t have other features to inject yet, I’d rather make the field required to prevent empty options. We can definitely reassess once we add new capabilities.

Copy link

@bcaudan bcaudan left a comment

Choose a reason for hiding this comment

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

Nice work

Copy link
Member

@yoannmoinet yoannmoinet left a comment

Choose a reason for hiding this comment

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

LGTM, well done!

@amortemousque
Copy link
Collaborator Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link

gh-worker-devflow-routing-ef8351 bot commented Feb 4, 2026

View all feedbacks in Devflow UI.

2026-02-04 15:48:16 UTC ℹ️ Start processing command /merge


2026-02-04 15:48:25 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-02-04 16:06:14 UTC ℹ️ MergeQueue: This merge request was already merged

This pull request was merged directly.

@yoannmoinet yoannmoinet merged commit e374e9d into master Feb 4, 2026
5 checks passed
@yoannmoinet yoannmoinet deleted the aymeric/rum-microfrontend branch February 4, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants