Skip to content

Conversation

@0Calories
Copy link
Contributor

Replaces the Fullstory Babel annotate plugin with our own version. See getsentry/sentry-javascript-bundler-plugins#468 for more details

This plugin essentially does the same thing, but will annotate the DOM with data-sentry-component annotations instead, which is what our SDK looks for when sending component name data to Sentry. This will allow us to start dogfooding new features like span grouping by component names, breadcrumbs, and component names in Replays!

Check out the NPM Page for more details on the plugin

@0Calories 0Calories self-assigned this Feb 2, 2024
@0Calories 0Calories requested review from a team as code owners February 2, 2024 00:12
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 2, 2024
@0Calories 0Calories changed the title feat(plugins): Add Sentry Babel plugin for react component annotation feat(plugins): Add Sentry Babel plugin for React component annotation Feb 2, 2024
@JonasBa
Copy link
Member

JonasBa commented Feb 2, 2024

@0Calories we rely on these names in at least one place in the codebase so merging this will break that logic. I have one instance where I rely on the data attribute here, but there might be others. Can we grep the codebase and update anything that might rely on the old dataset attributes?

@0Calories
Copy link
Contributor Author

Thanks for the heads up @JonasBa , I'll take a look

@0Calories
Copy link
Contributor Author

I realized that babel plugins must be prefixed with babel in their package name, otherwise it can't resolve if you try to add it to your babel config via the package name. I'm working on updating this first before proceeding

@0Calories
Copy link
Contributor Author

Update: It needs to be prefixed with babel-plugin, not babel 🤦

plugins: [
'@emotion/babel-plugin',
'@babel/plugin-transform-runtime',
'@babel/plugin-transform-class-properties',
Copy link
Member

Choose a reason for hiding this comment

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

Is it intentional to remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, forgot to put this one back in while I was experimenting. Not intentional

package.json Outdated
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
"@sentry/babel-plugin-component-annotate": "^2.13.0",
Copy link
Member

Choose a reason for hiding this comment

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

This will need to be in dependencies since we require it to build in prod

@0Calories
Copy link
Contributor Author

Currently failing in CI, as the getsentry PR needs to be merged first:

https://github.com/getsentry/getsentry/pull/12835

@0Calories 0Calories added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Feb 5, 2024
@0Calories 0Calories merged commit 8f5633b into master Feb 6, 2024
@0Calories 0Calories deleted the feat/use-sentry-component-annotate-plugin branch February 6, 2024 15:11
@github-actions github-actions bot locked and limited conversation to collaborators Feb 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants