Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[RUM-13448] Add source code context injection for microfrontend#255

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
amortemousque wants to merge1 commit intomaster
base:master
Choose a base branch
Loading
fromaymeric/rum-microfrontend

Conversation

@amortemousque
Copy link

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 (required) and version (optional) to identify microfrontend bundles
  • Injects minified, SSR-safe snippet that creates DD_SOURCE_CODE_CONTEXT global variable mapping stack traces to service/version metadata
  • Fixed injection plugin to support both production builds and watch/dev mode by adding watchRun hook
  • Added validation requiring service field and ensuring proper type checking
  • Comprehensive E2E tests covering context injection, stack trace mapping, and error handling across multiple bundlers

Copy link
Member

@yoannmoinetyoannmoinet 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.

Copy link
Member

Choose a reason for hiding this comment

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

Is this file accidentally duplicated?

returntoReturn;
}

constcfg=validatedOptions.sourceCodeContextasSourceCodeContextOptions;
Copy link
Member

Choose a reason for hiding this comment

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

Would this work?
I'm not a super fan ofas casting.

Suggested change
constcfg=validatedOptions.sourceCodeContextasSourceCodeContextOptions;
constcfg:SourceCodeContextOptions=validatedOptions.sourceCodeContext;

constcfg=validatedOptions.sourceCodeContextasSourceCodeContextOptions;

if(!cfg?.service||typeofcfg.service!=='string'){
toReturn.errors.push(`Missing${red('"sourceCodeContext.service"')}.`);
Copy link
Member

Choose a reason for hiding this comment

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

To avoid any confusion from user's standpoint.

Suggested change
toReturn.errors.push(`Missing${red('"sourceCodeContext.service"')}.`);
toReturn.errors.push(`Missing${red('"rum.sourceCodeContext.service"')}.`);

Comment on lines +45 to +47
{
entry:bundlers.reduce((acc,bundler)=>({ ...acc,[bundler]:'./index.js'}),{}),
},
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary?
Ithink this is the default.

constbundlerEntry=buildConfigOverride?.entry?.[bundler]||'./index.js';

Suggested change
{
entry:bundlers.reduce((acc,bundler)=>({ ...acc,[bundler]:'./index.js'}),{}),
},

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@yoannmoinetyoannmoinetyoannmoinet left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@amortemousque@yoannmoinet

[8]ページ先頭

©2009-2025 Movatter.jp