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(core): Add helpers to get module metadata from injected code #8438

Merged
merged 7 commits into from
Jul 4, 2023

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Jun 30, 2023

Part of the code required to better support Module Federation/Micro Frontends.

The webpack bundler will be able to optionally inject metadata into each bundle chunk (getsentry/sentry-javascript-bundler-plugins#334).

This PR adds code that:

  • Adds module_metadata to StackFrame
  • Adds getMetadataForUrl that gets metadata for a path/URL
    • Parses the stacks on demand to get the relevant filename for a chunk and associated injected metadata
  • Adds addMetadataToStackFrames that populates module_metadata in stack frames with metadata when available
  • Adds stripMetadataFromStackFrames that strips module_metadata from stack frames

@timfish timfish requested a review from lforst June 30, 2023 13:02
@timfish timfish changed the title feat(core): Add functions to get module metadata from injected code feat(core): Add helpers to get module metadata from injected code Jun 30, 2023
@timfish timfish marked this pull request as ready for review June 30, 2023 14:23
packages/utils/src/worldwide.ts Outdated Show resolved Hide resolved
packages/core/src/index.ts Outdated Show resolved Hide resolved
packages/core/src/metadata.ts Outdated Show resolved Hide resolved
packages/core/src/metadata.ts Outdated Show resolved Hide resolved
packages/core/src/metadata.ts Outdated Show resolved Hide resolved
packages/types/src/stackframe.ts Outdated Show resolved Hide resolved
@lforst lforst merged commit 1db809b into getsentry:develop Jul 4, 2023
64 checks passed
@timfish timfish deleted the feat/module-metadata branch July 4, 2023 12:46
Lms24 added a commit that referenced this pull request Nov 9, 2023
Add `<meta>` tag injection in our new `handleRequest` Astro
middleware to enable distributed traces between BE and FE transactions.

This is also the first step towards exporting a `<meta>` tag helper
function (tracked in #8438). In a future PR I'll extract the function to
the core or utils package and export it in our server-side SDKs.
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.

None yet

2 participants