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

Already on GitHub? Sign in to your account

feat(javascript): More micro frontends features #7558

Merged
merged 9 commits into from
Aug 8, 2023

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Jul 28, 2023

Pre-merge checklist

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs
  • PR was reviewed and approved by a member of the Sentry docs team

Description of changes

Document new micro frontends features:

  • New ModuleMetadata integration
  • Metadata injection via @sentry/webpack-plugin
  • Move multiplexed transport to its own page

@vercel
Copy link

vercel bot commented Jul 28, 2023

@timfish is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@timfish timfish marked this pull request as ready for review July 29, 2023 10:26
@vercel
Copy link

vercel bot commented Jul 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2023 5:01pm

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

very nice changes!

Co-authored-by: Francesco Novy <[email protected]>
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Could we add some details to the index on how all the different pieces are meant to be used together?

Copy link
Contributor

@shanamatthews shanamatthews left a comment

Choose a reason for hiding this comment

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

I left some comments with pointers on how to tweak these new docs to be more user-friendly.

It seems like users need to go through each page to understand how these different tools work together and which ones they need. It would be helpful to explain that on the index page.

Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

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

I think this is a great first step. Thanks a lot!

Some thoughts:

  • Did we explore putting all of the components on one page?
  • I believe it would be nice to have one coherent goal between all of the different steps. Maybe sending an event to different/multiple DSNs based on a team value being injected.

@timfish
Copy link
Collaborator Author

timfish commented Aug 3, 2023

Did we explore putting all of the components on one page?

I did but it started getting huge so I split it up. Now I'm reading the review comments I'm rethinking that! The metadata injection and metadata integration make more sense on a single page.

Could we add some details to the index on how all the different pieces are meant to be used together?

Pulling it all together is still a bit complex, hence this PR but I'll add this and some more exmples to the docs.

const ROUTE_TO_EXTRA_KEY = 'ROUTE_EVENT_TO';

const transport = makeMultiplexedTransport(createTransport, args => {
  const event = args.getEvent();
  if (event && event.extra && ROUTE_TO_EXTRA_KEY in event.extra && Array.isArray(event.extra[ROUTE_TO_EXTRA_KEY])) {
    return event.extra[ROUTE_TO_EXTRA_KEY];
  }
  return [];
});

function frameHasMetadataWithDsn(frame: StackFrame): boolean { 
  return 'module_metadata' in frame && 'dsn' in frame.module_metadata;
}

Sentry.init({
  dsn: '__DEFAULT_DSN__',
  integrations: [ new ModuleMetadata() ],
  transport,
  beforeSend: (event) => {
    if (event?.exception?.values?.[0].stacktrace?.frames) {
      // Reverse the stack frames so we can traverse from top to bottom
      const frames = event.exception.values[0].stacktrace.frames;
      const routeTo = frames.findLast(frameHasMetadataWithDsn) || [];

      if (routeTo.length) {
        event.extra = {
          ...event.extra,
          ROUTE_TO_EXTRA_KEY: routeTo,
        };
      }
    }

    return event;
  }
})

@shanamatthews
Copy link
Contributor

@timfish - tag me when you'd like me to take another look!

@timfish
Copy link
Collaborator Author

timfish commented Aug 5, 2023

@shanamatthews

I've reworked this back into a single file with a more cohesive story. The titles are now realted to the problem the user is solving rather than the individual tools!

Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

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

👍 Thanks Tim! Content-wise this looks good to me!

Co-authored-by: Abhijeet Prasad <[email protected]>
Copy link
Contributor

@shanamatthews shanamatthews left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the edits @timfish !

@AbhiPrasad AbhiPrasad merged commit 21ceae3 into getsentry:master Aug 8, 2023
5 checks passed
@AbhiPrasad
Copy link
Member

Thanks for your patience with this @timfish!!

@github-actions github-actions bot locked and limited conversation to collaborators Aug 24, 2023
@timfish timfish deleted the feat/js-module-metadata branch September 29, 2023 17:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants