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(js): Add micro-frontend docs #6754

Merged
merged 4 commits into from
May 2, 2023
Merged

Conversation

AbhiPrasad
Copy link
Member

Closes getsentry/sentry-javascript#7622

Adds preliminary docs for using the multiplexed transport introduced with getsentry/sentry-javascript#7926 for the micro-frontends use case.

Adds a warning about async context support meaning that we cannot isolate breadcrumbs/spans.

@AbhiPrasad AbhiPrasad self-assigned this Apr 27, 2023
@vercel
Copy link

vercel bot commented Apr 27, 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 May 2, 2023 0:08am

@AbhiPrasad AbhiPrasad requested review from a team, mydea and lforst and removed request for a team April 27, 2023 15:43
@AbhiPrasad AbhiPrasad marked this pull request as ready for review April 27, 2023 15:43
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.

language tweaks, style tweaks, fenced code block language standardization


init({
dsn: '__FALLBACK_DSN__',
transport: makeMultiplexedTransport(makeFetchTransport, dsnFromFeature)
Copy link
Contributor

Choose a reason for hiding this comment

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

Random question but might be relevant to document: which ones are called first: the "matcher" ("dsnFromFeature") or the init's "beforeSend"?

As an example, if I enhance my event tags at init's beforeSend (e.g. I add "event.tags.feature = cart"), will the enhanced event tags be available at this matcher (i.e. at dsnFromFeature when getEvent() is called)?

Context: before this multiplexed transport feature is available, one workaround to send different event to different Sentry project is via beforeSend and initialize a BrowserClient there (https://github.com/sentry-demos/sentry-micro-frontend/blob/5996c4b528f58696b729db9d41f4962a83c53c77/methods/simple-remote.js#LL42C28-L42C28) So when implementing this mechanism at my company, my implementation actually adds more tags there than just finding out relevant DSN to send to (e.g. I added the micro app's release info). If I could access the tags added in "beforeSend" when the matcher is called, I could reduce some code duplication. However if that's not possible, it's also ok too for me.

Thanks~

Copy link
Member Author

Choose a reason for hiding this comment

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

The init's beforeSend is called before the matcher's dsnFromFeature. Will call this out in the docs - thanks for updating it!

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) May 2, 2023 11:58
@AbhiPrasad
Copy link
Member Author

Thanks for the review @shanamatthews!

@AbhiPrasad AbhiPrasad merged commit 09d5fa4 into master May 2, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-micro-frontend-docs branch May 2, 2023 12:04
@github-actions github-actions bot locked and limited conversation to collaborators May 18, 2023
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.

Recommended way to use micro-frontends with Sentry JS SDK
3 participants